diff --git a/app/build.gradle b/app/build.gradle index 0d6d0ae..f235272 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -24,7 +24,7 @@ def releaseTime() { return new Date().format("yy.MMddHH", TimeZone.getTimeZone("GMT+08:00")) } -def gitCommits = Integer.parseInt('git rev-list HEAD --count'.execute().text.trim()) +def commitId = 'git rev-parse --short HEAD'.execute().text.trim() def getVersionCode() { def versionCodeFile = file('version_code.properties') @@ -122,14 +122,19 @@ android { signingConfig signingConfigs.myConifg } applicationIdSuffix ".debug" - versionNameSuffix "-" + gitCommits + versionNameSuffix "-" + commitId ndk { abiFilters "arm64-v8a" } } android.applicationVariants.all { variant -> + def buildType = variant.buildType.name + def fileName = "${name}v${defaultConfig.versionName}.apk" + if (buildType == "debug"){ + fileName = "${name}v${defaultConfig.versionName}-${commitId}.apk" + } variant.outputs.all { - outputFileName = "${name}v${defaultConfig.versionName}.apk" + outputFileName = fileName } } }