butterknife 配置了点击和绑定无效


配置了butterknife 没有报错,但是控件绑定和点击均无效。

问题原因:

butterknife配置不完善问题导致。

解决办法:

找到app的module的build.gradle

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.jakewharton:butterknife:8.4.0'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0' //必须要有,不然就会出现以上问题
    compile 'com.android.support:support-v4:23.4.0'
    testCompile 'junit:junit:4.12'
    compile 'de.greenrobot:eventbus:3.0.0-beta1'
    compile 'com.tbruyelle.rxpermissions:rxpermissions:0.8.0@aar'
}

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM