美文网首页
butterknife 绑定无效

butterknife 绑定无效

作者: vampirealone | 来源:发表于2019-02-26 16:56 被阅读0次

android studio3.0以上版本中,butterknife的导入有所改变

dependencies {

    compile 'com.jakewharton:butterknife:8.8.1'

    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

}

不需要在project的根build.gradle再进行其他的导入。

如果以上都确认无误,但发现onClick和bindView都无效的情况,检查下以上的依赖是不是设置在其他module中,如果是,那么问题基本找到了。

比如module A依赖module B,module B导入butterknife,那么A是无法直接使用butterknife的,需要在A的build.gradle里面加入如下依赖:

dependencies {

    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

}

相关文章

网友评论

      本文标题:butterknife 绑定无效

      本文链接:https://www.haomeiwen.com/subject/tvfzyqtx.html