最近在更新ButterKnife时发现出了点问题,到官网看了一下,原来ButterKnife使用apt.配置也要进行相应的更改
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'
}
然后就可以使用啦~