(使用9.0.0版本,10+版本不适用)
1、项目build.gradle中加入:
classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0'
2、各个module中加入
apply plugin: 'com.jakewharton.butterknife'
api 'com.jakewharton:butterknife:9.0.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0'
3、app的gradle中defaultConfigzhogn 加入
javaCompileOptions {
// 显式声明支持注解
annotationProcessorOptions {
includeCompileClasspath true
}
}