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
根據(jù)以上IDE工具以及對(duì)應(yīng)的插件版本,搭建了一個(gè)Android 項(xiàng)目,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
}
當(dāng)搭建完項(xiàng)目之后進(jìn)行構(gòu)建,會(huì)發(fā)現(xiàn)AS報(bào)了如下警告:
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: *****
看到以上信息,我們都能看懂這個(gè)警告的原因是在當(dāng)前的Android Gradle Plugin Version中,API->variantOutput.getPackageLibrary()已經(jīng)過(guò)時(shí)了,替代它的是variant.getPackageLibraryProvider()
那么我們會(huì)發(fā)現(xiàn),新搭建的項(xiàng)目,我們并沒(méi)有使用到這些API接口,為什么會(huì)報(bào)出這個(gè)警告呢?
經(jīng)過(guò)多方資料查閱,這個(gè)是谷歌在做相應(yīng)版本升級(jí)時(shí)遺留下來(lái)的問(wèn)題,它并不是bug,只是會(huì)影響到同您一樣,看到這個(gè)警告渾身不舒服的同類人!
解決方案:
1、等待升級(jí),看是否能去掉這個(gè)警告
2、降低版本,退回會(huì)出現(xiàn)這個(gè)警告之前的版本
我的解決方案是:降低版本
classpath 'com.android.tools.build:gradle:3.4.2'
--->
classpath 'com.android.tools.build:gradle:3.2.1'
總結(jié)
以上是生活随笔為你收集整理的com.android.tools.build:gradle:2.3.3,关于com.android.tools.build:gradle:3.4.2的构建问题的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: qt中关于按钮的click()函数卓见
- 下一篇: 简述Qt编程中遇到的编码格式问题