美文网首页
epoxy 作为lib 或者 module 的时候 R 文件不生

epoxy 作为lib 或者 module 的时候 R 文件不生

作者: 整整代码 | 来源:发表于2020-06-02 15:02 被阅读0次

As错误提示: attribute value must be constant

If you are using layout resources in Epoxy annotations then for library projects add Butterknife's gradle plugin to your buildscript.

buildscript {
  repositories {
    mavenCentral()
   }
  dependencies {
    classpath 'com.jakewharton:butterknife-gradle-plugin:10.1.0'
  }
}

and then apply it in your module:

apply plugin: 'com.android.library'
apply plugin: 'com.jakewharton.butterknife'

Now make sure you use R2 instead of R inside all Epoxy annotations.

总结就是引入butterknife 用R2 替换所有的R 就可以了

相关文章

网友评论

      本文标题:epoxy 作为lib 或者 module 的时候 R 文件不生

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