AGP 3.3 和 Gradle 5.0 对已过时且将于 2019 年底删除的变体发出警告

Posted

技术标签:

【中文标题】AGP 3.3 和 Gradle 5.0 对已过时且将于 2019 年底删除的变体发出警告【英文标题】:AGP 3.3 and Gradle 5.0 warning for variants that are obsolete and will be removed at the end of 2019 【发布时间】:2019-05-08 02:13:57 【问题描述】:

我一直在使用 AS 3.3-rc1 和 AGP 3.3-rc1 并更新到 Gradle 5.0

从那以后我收到了这个警告。

有谁知道我怎样才能摆脱它们?

无法从here 和here 中找出任何信息。

难道只是因为它们是 RC 版本还是什么?

WARNING: API 'variant.getAssemble()' is obsolete and has been replaced with 'variant.getAssembleProvider()'.
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 variant.getAssemble(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.
WARNING: API 'variantOutput.getProcessResources()' is obsolete and has been replaced with 'variantOutput.getProcessResourcesProvider()'.
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.getProcessResources(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.
WARNING: API 'variantOutput.getProcessManifest()' is obsolete and has been replaced with 'variantOutput.getProcessManifestProvider()'.
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.getProcessManifest(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.
WARNING: API 'variant.getMergeResources()' is obsolete and has been replaced with 'variant.getMergeResourcesProvider()'.
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 variant.getMergeResources(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.
WARNING: API 'variant.getMergeAssets()' is obsolete and has been replaced with 'variant.getMergeAssetsProvider()'.
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 variant.getMergeAssets(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.
WARNING: API 'variant.getPackageApplication()' is obsolete and has been replaced with 'variant.getPackageApplicationProvider()'.
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 variant.getPackageApplication(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.
WARNING: API 'variant.getExternalNativeBuildTasks()' is obsolete and has been replaced with 'variant.getExternalNativeBuildProviders()'.
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 variant.getExternalNativeBuildTasks(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.

更新:

通过我的老朋友 Divide et Impera 方法,我找到了罪魁祸首,并且是 Fabric Gradle 插件

apply plugin: 'io.fabric'

期待他们的 github repo 看看是否已经存在问题。

无论如何,我想从长远来看,一旦 Fabric 使他们的插件与新 API 兼容,这些警告就会消失。

更新 2

与此相关的 Fabric GitHub 问题:

这是一般https://github.com/firebase/firebase-android-sdk/issues/230 这是索引较多的一个: https://github.com/firebase/firebase-android-sdk/issues/198 被此SO question 索引。

您所要做的就是什么,只需 w8 即可获得下一个 Fabric 插件版本。

【问题讨论】:

我想这个问题与那个问题有关:***.com/questions/52412023/… 我也把我的问题留在这里,以便更好地索引这个问题。 (对我来说不幸的是,我在所有调查之后才发现它...... ^^) 是的! io.fabric 是罪魁祸首,我确认! 【参考方案1】:

将下面的行添加到 project/gradle/wrapper/Gradle-wrapper.properties

android.debug.obsoleteApi=true

【讨论】:

谢谢,正如您在我更新的问题中看到的那样,我已经发现哪个插件会导致此警告。顺便说一句,这是(并且应该是)一个很好的提示。 谢谢,为我工作。 修复:实际上需要添加到 gradle-wrapper.properties 而不是 Gradle.properties .. 干杯 gradle-wrapper.properties 与 gradle wrapper 有关,与此警告无关。

以上是关于AGP 3.3 和 Gradle 5.0 对已过时且将于 2019 年底删除的变体发出警告的主要内容,如果未能解决你的问题,请参考以下文章

Gradle 与 AGP 构建 API: 如何编写插件

AGP 3.5 与 Gradle 6 兼容吗?

Gradle Receipes (AGP-7.3) & AGP 使用指南

Gradle 与 AGP 构建 API: 进一步完善您的插件!

Gradle 与 AGP 构建 API: 配置您的构建文件

Gradle 与 AGP 构建 API: 配置您的构建文件