如何在android库中集成Butterknife?
我正在android中处理现有项目,我想将android项目转换为android库。 在该项目中,butterknife库用于绑定UI组件。当我尝试使用已成功同步的项目将项目转换为库,但使用了butterknife的所有文件时,我遇到以下错误“所有@BindView组件的属性值必须为常量” 下面是我对gradle文件所做的更改如何在android库中集成Butterknife?,android,android-studio,butterknife,Android,Android Studio,Butterknife,我正在android中处理现有项目,我想将android项目转换为android库。 在该项目中,butterknife库用于绑定UI组件。当我尝试使用已成功同步的项目将项目转换为库,但使用了butterknife的所有文件时,我遇到以下错误“所有@BindView组件的属性值必须为常量” 下面是我对gradle文件所做的更改 应用程序级渐变: 项目级梯度: //顶级生成文件,您可以在其中添加所有子项目/模块通用的配置选项 我也参考了这篇文章,并做了相应的修改。 但我无法解决R2的错误 @Bi
@BindView(R2.id.user) EditText userName;
我怎样才能做到这一点
任何帮助都将不胜感激
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
mavenCentral()
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.google.gms:google-services:4.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// Add the Crashlytics Gradle plugin.
// classpath 'com.google.firebase:firebase-crashlytics-gradle:2.0.0-beta02'
classpath 'com.jakewharton:butterknife-gradle-plugin:10.2.3'
}
}
allprojects {
repositories {
google()
jcenter()
flatDir {
dirs 'libs'
}
}
}
ext {
rxJava = '2.2.0'
rxAndroid = '2.1.0'
}
task clean(type: Delete) {
delete rootProject.buildDir
}
@BindView(R2.id.user) EditText userName;