AndroidStudio Gradle打包自动输出名称格式

在app的build.gradle添加代码:

android {

......

    android.applicationVariants.all { variant ->
        variant.outputs.all {
            if (variant.buildType.name == 'release') {
                outputFileName = "App-${versionName}-${new Date().format("yyyyMMddHHmm", TimeZone.getTimeZone("GMT+8"))}-release.apk"
            } else {
                outputFileName = "App-${versionName}-${new Date().format("yyyyMMddHHmm", TimeZone.getTimeZone("GMT+8"))}-debug.apk"
            }
        }
    }
}

猜你喜欢

转载自blog.csdn.net/HJ_CQ/article/details/120847252
今日推荐