com.android.tools.build:gradle:2.3.3,关于com.android.tools.build:gradle:3.4.2的构建问题

Android Studio Version:3.4.2

Android Gradle Plugin Version:3.4.2

Gradle Version:5.1.1

根据以上IDE工具以及对应的插件版本,搭建了一个Android 项目,app的build.gradle如下:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

repositories {

google()

jcenter()

}

dependencies {

classpath 'com.android.tools.build:gradle:3.4.2'

// NOTE: Do not place your application dependencies here; they belong

// in the individual module build.gradle files

}

}

allprojects {

repositories {

google()

jcenter()

}

}

task clean(type: Delete) {

delete rootProject.buildDir

}

当搭建完项目之后进行构建,会发现AS报了如下警告:

WARNING: API 'variantOutput.getPackageLibrary()' is obsolete and has been replaced with 'variant.getPackageLibraryProvider()'.

It will be removed at the end of 2019.

For more information, see https://d.android.com/r/tools/task-configuration-avoidance.

To determine what is calling variantOutput.getPackageLibrary(), use -Pandroid.debug.obsoleteApi=true on the command line to display more information.

Affected Modules: *****

看到以上信息,我们都能看懂这个警告的原因是在当前的Android Gradle Plugin Version中,API->variantOutput.getPackageLibrary()已经过时了,替代它的是variant.getPackageLibraryProvider()

那么我们会发现,新搭建的项目,我们并没有使用到这些API接口,为什么会报出这个警告呢?

经过多方资料查阅,这个是谷歌在做相应版本升级时遗留下来的问题,它并不是bug,只是会影响到同您一样,看到这个警告浑身不舒服的同类人!

解决方案:

1、等待升级,看是否能去掉这个警告

2、降低版本,退回会出现这个警告之前的版本

我的解决方案是:降低版本

classpath 'com.android.tools.build:gradle:3.4.2'

--->

classpath 'com.android.tools.build:gradle:3.2.1'

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值