通过android-apt方式引入依赖butterknife.BindView
时,报错android-apt plugin is incompatible with the Android Gradle plugin. Please use 'annotationProcessor’。其原因是Android官方提供了annotationProcessor
来代替android-apt
,所以在高版本的gradle中,不允许使用apt
.
解决方式:
1.将项目根目录下,build.gradle中的classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
删除
2.将app目录下,build.gradle开头的apply plugin: 'com.neenbedankt.android-apt'
删除。
3.将app目录下,在build.gradle中,通过annotationProcessor
引入依赖即可。
dependencies {
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
}