问题描述
从 2.2 升级到 2.3 后,我看到此警告
After upgrading from 2.2 to 2.3 I see this warning
当我尝试编译项目时,我看到了这个编译错误
and when I try to compile the project I see this compilation error
如何在不降级到以前的 gradle 版本的情况下解决此问题?android-apt 有没有更新可以解决这个问题?
How can i solve this issue without downgrading to a previous gradle version?Is there any update of android-apt that can solve this issue?
推荐答案
android-apt
插件已被弃用.
在此处查看迁移指南:
从 Android Gradle 插件版本 2.2 开始,以前由 android-apt 提供的所有功能现在都可以在 Android 插件中使用了.
您可以按照迁移指南删除 android-apt
以获得等效功能.
You can remove android-apt
by following the migration guide to get the equivalent functionalities.
迁移指南中的重要部分:
- 确保您使用的是 Android Gradle 2.2 插件或更新版本.
- 从构建脚本中删除
android-apt
插件 - 将所有
apt
、androidTestApt
和testApt
依赖项更改为它们的新格式:
dependencies {
compile 'com.google.dagger:dagger:2.0'
annotationProcessor 'com.google.dagger:dagger-compiler:2.0'
}
在 Android Gradle 插件中也有一个明确的检查,这就是你所看到的:
Also in the Android Gradle plugin there is an explicit check for this, which is what you are seeing:
使用不兼容的插件进行注释处理 android-apt
未来的 Android Gradle 插件版本将与 android-apt
的工作方式不兼容,这就是进行该检查的原因.
Future Android Gradle plugin versions will not be compatible with the way android-apt
works, which is the reason for that check.
这篇关于升级到 Android Studio 2.3 后 android-apt 的插件不兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!