最近在更新ButterKnife時發(fā)現(xiàn)出了點問題,到官網(wǎng)看了一下,原來ButterKnife使用apt.配置也要進行相應(yīng)的更改
Project build.gradle
首先在項目的build.gradle添加apt引用
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'
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
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
module build.gradle配置
在要使用ButterKinfe的module的build.gradle中添加apt插件引用
3apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
...
然后添加ButterKinfe的引用
dependencies {
compile 'com.jakewharton:butterknife:8.2.1'
apt 'com.jakewharton:butterknife-compiler:8.2.1'
}
然后就可以使用啦~