本文介绍了虽然 Android Studio 更新到 v3.3 获取 API 'variant.getAssemble()' 已过时并已替换为 'variant.getAssembleProvider()'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

收到此警告(即使 variant.getAssemble() 未在任何地方使用):

Getting this Warning (Even when variant.getAssemble() is not used anywhere):

API 'variant.getAssemble()' is obsolete and has been replaced with 'variant.getAssembleProvider()'.

我更新了以下组件:安卓工作室

I have updated following components:Android Studio

v3.3

Gradle 插件

v3.3

Gradle 分发 URL (gradle-wrapper.properties)

Gradle Distribution URL (gradle-wrapper.properties)

distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip

gradle.properties

gradle.properties

android.debug.obsoleteApi=true

推荐答案

variant.assemble 已弃用并由新的提供程序 API 取代.

variant.assemble has been deprecated and replaced by a new provider API.

例如,如果您将其用作下一个:

If for example you are using it as next:

variant.outputs.all { output ->
        variant.assemble.doLast {
            ....
        }
    }
}

然后将其替换为新的提供程序 API:

Then replace it the new provider API:

variant.outputs.all { output ->
    variant.getAssembleProvider().configure() {
        it.doLast {
            ....
        }
    }
}

这篇关于虽然 Android Studio 更新到 v3.3 获取 API 'variant.getAssemble()' 已过时并已替换为 'variant.getAssembleProvider()'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-14 09:28