基于ButterKnife库,我升级到新版本8.5.1。我用过
compile 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'但它在我的Android 2.3中警告我。而且ButterKnife不能工作(不能绑定视图)。
警告:在注释处理中使用不兼容的插件:android。这可能会导致意外的行为。
我将annotationProcessor更改为 apt (我在gradle中有了插件apply plugin: 'com.neenbedankt.android-apt' ),它在没有警告的情况下作为旧版本工作(我用apt处理旧版本8.4.0)
compile 'com.jakewharton:butterknife:8.5.1'
apt 'com.jakewharton:butterknife-compiler:8.5.1'我认为AndroidStudio2.3与Annottaion处理是无法兼容的。我在AndroidStudio2.2中搜索并找到了启用注释处理器,但在AndroidStudio2.3中找不到
设置>生成、执行、部署>编译器>注释处理器
有人能解释这个问题吗?谢谢!
发布于 2017-03-16 04:28:18
好心的
//apply plugin: 'com.neenbedankt.android-apt' <--remove this
apply plugin: 'com.jakewharton.butterknife' <-- add this
dependencies {
//classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' <-- remove this
classpath 'com.jakewharton:butterknife-gradle-plugin:8.5.1' <-- add this
}然后在应用程序依赖项中
//蝴蝶刀
compile 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'发布于 2017-06-12 16:08:40
简单又简单。只需将这些行添加到您的build.gradle
compile 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'发布于 2017-06-07 05:42:57
Gradle版本2.2中包含了注释处理器,因此没有理由提供额外的注释处理器。
检查我更新的答案这里。
https://stackoverflow.com/questions/42825172
复制相似问题