android Modify the package name of the output apk

1. Use the IDE menu option in packaging mode

2. Configure under app-level build.gradle:

static def releaseTime() {
    return new Date().format("yyyyMMdd.kkmm", TimeZone.getTimeZone("GMT+8"))
}

android.applicationVariants.all { variant ->
    println('============')
    println(variant.name)

    variant.outputs.each { output ->
        def file = output.outputFile
        output.outputFileName = file.name.replace(".apk", "-xxxx-${variant.versionName}-${variant.versionCode}-${releaseTime()}.apk")
        println(output.outputFileName)

    }
}

Guess you like

Origin blog.csdn.net/Steve_XiaoHai/article/details/133686790
Recommended