1. 程式人生 > >Gradle 修改生成apk時的檔名

Gradle 修改生成apk時的檔名

android{
    //....code
   android.applicationVariants.all {
        variant ->
            variant.outputs.all {

                output -> outputFileName  = new File(variant.name, "運維小助手" + "_v" + defaultConfig.versionName + "_" + buildType.name + releaseTime() + ".apk")
            }

    }
    //code...
}

static def releaseTime() {
    return new Date().format
("yyyy-MM-dd", TimeZone.getTimeZone("UTC")) }