修改生成的apk名字

This commit is contained in:
LittleTurtle2333
2023-02-24 18:08:29 +08:00
parent 62f08e5bcf
commit 4f20d364c6

View File

@@ -14,8 +14,6 @@ android {
versionCode 75
versionName '1.7.5-Yuki'
buildConfigField("String", "BUILD_TIME", "\"${System.currentTimeMillis()}\"")
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
@@ -44,6 +42,25 @@ android {
lintOptions {
checkReleaseBuilds false
}
android.applicationVariants.all { variant ->
variant.outputs.each { output ->
// 名称+当前版本号
def fileName = "WooBoxForMIUI_v${defaultConfig.versionName}"
// 加入打包日期
def releaseDate = new Date().format("MMddHHmmss", TimeZone.getDefault())
fileName = fileName + "_${releaseDate}"
// 如果是debug版本加入debug
if ( variant.buildType.name =='debug') {
fileName = fileName + "_debug"
}else if(variant.buildType.name =='release') {
fileName = fileName + "_release"
}
// 最终生成文件名
output.outputFileName = fileName + ".apk"
}
}
}
dependencies {