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'
總結
以上是生活随笔為你收集整理的com.android.tools.build:gradle:2.3.3,关于com.android.tools.build:gradle:3.4.2的构建问题的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: qt中关于按钮的click()函数卓见
- 下一篇: 简述Qt编程中遇到的编码格式问题