前提:更新androidX出现butterknife报错问题
androidX 是对 android.support.xxx 包的整理后产物。由于之前的support包过于混乱,所以,google推出了 androidX。
报错信息
Failed to transform artifact 'butterknife-compiler.jar (com.jakewharton:butterknife-compiler:9.0.0)
- Failed to transform artifact 'butterknife-compiler.jar (com.jakewharton:butterknife-compiler:9.0.0)
Failed to transform artifact 'butterknife-compiler.jar (com.jakewharton:butterknife-compiler:9.0.0)
解决方法
改变一下butterknife的版本即可
implementation 'com.jakewharton:butterknife:10.0.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'
- implementation 'com.jakewharton:butterknife:10.0.0'
- annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'
implementation 'com.jakewharton:butterknife:10.0.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'
并且dependencies里添加的butterknife也可以注释
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
// classpath "com.jakewharton:butterknife-gradle-plugin:9.0.0-rc3"
}
- dependencies {
- classpath 'com.android.tools.build:gradle:3.4.1'
- // classpath "com.jakewharton:butterknife-gradle-plugin:9.0.0-rc3"
- }
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
// classpath "com.jakewharton:butterknife-gradle-plugin:9.0.0-rc3"
}
扩展
但也有试过用kotlin也可以解决(未验证)
implementation "com.jakewharton:butterknife:10.0.0"
kapt "com.jakewharton:butterknife-compiler:10.0.0"
- implementation "com.jakewharton:butterknife:10.0.0"
- kapt "com.jakewharton:butterknife-compiler:10.0.0"
implementation "com.jakewharton:butterknife:10.0.0"
kapt "com.jakewharton:butterknife-compiler:10.0.0"