按此方法配置,解决空指针。
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’