升级到 Android Studio 2.3 后 android-apt 的插件不兼容
从 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 插件中使用了.
As of the Android Gradle plugin version 2.2, all functionality that was previously provided by android-apt is now available in the Android plugin.
您可以按照迁移指南删除 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
依赖项更改为它们的新格式:
- Make sure you are on the Android Gradle 2.2 plugin or newer.
- Remove the
android-apt
plugin from your build scripts- Change all
apt
,androidTestApt
andtestApt
dependencies to their new format:
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
using incompatible plugins for the annotation processing 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.