1.添加黄油刀插件
根build添加:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
//黄油刀
classpath 'com.jakewharton:butterknife-gradle-plugin:8.8.1'
}
}
app的build添加:
apply plugin: 'com.jakewharton.butterknife'//最上面添加插件
//添加依赖
compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
注意!!!AS3.0以后不用添加apply plugin: ‘com.jakewharton.butterknife’
只需要添加:
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'