升级到 gradle 3.3 和 android build tools 2.3.0 时收到构建错误
- 作者: 爆炸的球
- 来源: 51数据库
- 2022-11-16
问题描述
我刚刚更新了构建文件
从 2.14.1 升级到 3.3从 2.2.3 到 2.3.0 的 Android 插件
Gradle from 2.14.1 to 3.3 Android Plugin from 2.2.3 to 2.3.0
我收到以下错误.似乎是一些第三方插件问题.任何人都可以阐明它吗?我在更改日志中找不到与此更改相关的任何内容.
I am receiving the following error. Seems like some thirdparty plugin issue. Can anyone shed light to it? I cant find anything in change logs related to this change.
配置项目 ':apis' 时出现问题.
A problem occurred configuring project ':apis'.
未能通知项目评估侦听器.
Failed to notify project evaluation listener.
机器人"命令不再包含在 SDK 中.任何参考应该删除它(例如通过第三方插件).
The "android" command is no longer included in the SDK. Any references to it (e.g. by third-party plugins) should be removed.
引发错误的构建文件如下所示
The build file in which error is thrown looks something like this
apply plugin: 'android-sdk-manager'
apply plugin: 'com.android.library'
apply plugin: 'android-apt'
android {
compileSdkVersion Integer.parseInt(ANDROID_SDK_VERSION)
buildToolsVersion ANDROID_BUILD_TOOLS_VERSION
// Legacy apache network stack
useLibrary 'org.apache.http.legacy'
defaultConfig {
minSdkVersion Integer.parseInt(ANDROID_MIN_SDK_VERSION)
targetSdkVersion Integer.parseInt(ANDROID_SDK_VERSION)
consumerProguardFiles 'proguard-rules.pro'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
packagingOptions {
exclude 'LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE'
}
lintOptions {
abortOnError false
}
}
...
推荐答案
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 and follow the migration guide to get the equivalent functionality.
同样,根据 sdk-manager-plugin 页面:
此插件已弃用,不再开发.使用 2.2.0 版自动下载工具和依赖项Android Gradle 插件或更新版本.
This plugin is deprecated and is no longer being developed. Tools and dependencies are automatically downloaded using version 2.2.0 of the Android Gradle plugin or newer.
所以它也可以被删除.
