ButterKnife集成:
在project的gradle中配置apt技术
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'
//以下是添加的内容,用于配置apt
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
在Android目录下,进入build.gradle(module.app)目录下,添加ButterKnife的依赖:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
//ButterKnife的依赖
compile 'com.jakewharton:butterknife:8.4.0'
apt 'com.jakewharton:butterknife-compiler:8.4.0'
}
然后,Sync Now即可。