Gradle: applicationVariants.all skips one variant

后端 未结 3 1917
感情败类
感情败类 2021-02-03 13:00

I\'m using Gradle to compile my Android project:

buildTypes {
    release {
        signingConfig signingConfigs.release 
        applicationVariants.all { varia         


        
3条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-03 13:16

    I simplified it by removing one of your lines but essentially you need to change it like so:

    android {
    
        buildTypes {
        ...
        }
    
        applicationVariants.all { variant ->
            def file = variant.outputFile
            def fileName = file.name.replace(".apk", "-renamed".apk")
            variant.outputFile = new File(file.parent, fileName)
        }
    }
    

提交回复
热议问题