升级到 gradle 3.3 和 android build tools 2.3.0 时收到构建错误

Receiving a build error when upgrading to gradle 3.3 and android build tools 2.3.0(升级到 gradle 3.3 和 android build tools 2.3.0 时收到构建错误)
本文介绍了升级到 gradle 3.3 和 android build tools 2.3.0 时收到构建错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我刚刚更新了构建文件

从 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.

所以它也可以被删除.

这篇关于升级到 gradle 3.3 和 android build tools 2.3.0 时收到构建错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Android release APK crash with java.lang.AssertionError: impossible in java.lang.Enum(Android 发布 APK 因 java.lang.AssertionError 崩溃:在 java.lang.Enum 中不可能)
Finished with Non Zero Exit Value 3(以非零退出值 3 结束)
On gradle:3.0.0 More than one file was found with OS independent path #39;META-INF/ASL2.0#39;(在 gradle:3.0.0 上找到多个文件,其独立于操作系统的路径为“META-INF/ASL2.0)
Android : app loading library at runtime on Lollipop but not IceCreamSandwich(Android:运行时在 Lollipop 上而不是 IceCreamSandwich 上的应用程序加载库)
buildConfigField depending on flavor + buildType(buildConfigField 取决于风味 + buildType)
How do I suppress warnings when compiling an android library with gradle?(使用 gradle 编译 android 库时如何抑制警告?)