ButterKnife 8.x版本在AndroidStudio中的配置

时间:2021-07-26 15:53:39

按此方法配置,解决空指针。
1.Project的build.gradle文件中增加classpath

buildscript {
repositories {
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'

}

}

allprojects {
repositories {
jcenter()
}

}

task clean(type: Delete) {
delete rootProject.buildDir
}

2.在Module的build.gradle文件中增加plugin

apply plugin: ‘com.neenbedankt.android-apt’

3.在Module的build.gradle中的Dependencies中依赖包

compile ‘com.jakewharton:butterknife:8.6.0’
apt ‘com.jakewharton:butterknife-compiler:8.6.0’