相关疑难解决方法(0)

variantOutput.getPackageApplication()已过时

随着Gradle 4.10.1和Android Gradle插件的更新3.3.0,我得到以下警告:

警告:API' variantOutput.getPackageApplication()'已过时,已替换为' variant.getPackageApplicationProvider()'.

该行,与周围的上下文(由构建变量分配输出文件名):

applicationVariants.all { variant ->
    variant.outputs.all { output ->

        if (variant.getBuildType().getName() in rootProject.archiveBuildTypes) {

            def buildType = variant.getBuildType().getName()
            if (variant.versionName != null) {

                def baseName = output.baseName.toLowerCase()
                String fileName = "${rootProject.name}_${variant.versionName}-${baseName}.apk"

                // this is the line:
                outputFileName = new File(output.outputFile.parent, fileName).getName()
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

迁移指南是不是太有帮助; 虽然variant.outputs.all可能有问题 - 只是不知道要替换什么 - 并且迁移指南指的是任务而不是构建变体.禁用时File ? Settings ? Experimental ? Gradle ? Only sync the active variant,我会得到更多的弃用警告(重点是,这些方法都没有被直接调用): …

gradle build.gradle android-gradle-plugin deprecation-warning build-variant

24
推荐指数
2
解决办法
2万
查看次数

虽然Android Studio已更新至v3.3,但API'variant.getAssemble()'已过时且已替换为'variant.getAssembleProvider()'

获得此警告(即使在variant.getAssemble()任何地方都没有使用):

API 'variant.getAssemble()' is obsolete and has been replaced with 'variant.getAssembleProvider()'.
Run Code Online (Sandbox Code Playgroud)

我更新了以下组件:Android Studio

v3.3

Gradle PlugIn

v3.3

Gradle分发URL (gradle-wrapper.properties)

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

gradle.properties

android.debug.obsoleteApi=true

android gradle android-studio gradle-plugin

6
推荐指数
2
解决办法
2657
查看次数