android - 升级到 gradle 3.3 和 android 构建工具 2.3.0 时收到构建错误

标签 android gradle android-gradle-plugin

我刚刚更新了我的构建文件

从 2.14.1 升级到 3.3 Android 插件从 2.2.3 到 2.3.0

我收到以下错误。似乎是一些第三方插件问题。任何人都可以阐明它吗?我在更改日志中找不到与此更改相关的任何内容。

A problem occurred configuring project ':apis'.

Failed to notify project evaluation listener.

The "android" command is no longer included in the SDK. Any references to it (e.g. by third-party plugins) should be removed.

抛出错误的构建文件看起来像这样

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 已被弃用,并且根据 migration guide :

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 并按照迁移指南获取等效功能。

同样,根据 sdk-manager-plugin page :

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.

所以它也可以被移除。

关于android - 升级到 gradle 3.3 和 android 构建工具 2.3.0 时收到构建错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42571034/

相关文章:

gradle - 哪个文件 gradle.properties 的优先级更高?

android - 运行Flutter Doctor时Android许可证状态未知

android - Android Studio 中的 Gradle 无法解析 JCenter 中的库

android - 我的android项目中使用android-maven-gradle-plugin的aar依赖错误

java - 从 JSON 对象中提取字符串

java - 屏幕底部 1/3 处的对齐按钮

unity3d - Unity导出中Android支持编译的Gradle问题

android - 确定 View 是否在屏幕上 - Android

android-studio - 系统找不到Android Studio指定的文件

java - "Compilation failed; see the compiler error output for details."错误