android studio 3.1: build:gradle:3.1.0 - Absolute path are not supported when setting an output file name

后端 未结 7 946
囚心锁ツ
囚心锁ツ 2020-12-05 19:32

When I use Android Studio 3.0 and I use the next version of Android Gradle Plugin in project/build.gradle:

cl         


        
7条回答
  •  天涯浪人
    2020-12-05 19:37

    Use variant.packageApplicationProvider.get().outputDirectory to avoid warning "variantOutput.getPackageApplication() is obsolete"

    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            variant.packageApplicationProvider.get().outputDirectory = new File(
                project.rootDir.absolutePath + "/release")
    
            def releaseFileName = "${rootProject.name}_${defaultConfig.versionName}.apk"
            output.outputFileName = releaseFileName.toLowerCase()
        }
    }
    

提交回复
热议问题