def releaseTime() {
return new Date().format("yyyy-MM-dd-HH_mm_ss", TimeZone.getTimeZone("GMT+08:00"))
}
android {
signingConfigs {
release {
storeFile file("../key.jks")//签名文件放于项目根目录
storePassword "123456"
keyAlias "key0"
keyPassword "123456"
v1SigningEnabled true
v2SigningEnabled true
}
}
buildTypes {
debug {
minifyEnabled false
signingConfig signingConfigs.release
}
release {
minifyEnabled true
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
android.applicationVariants.all {
variant ->
variant.outputs.all {
//com.companyname.projectname_release_v1.0.0-2021-08-12-10_27_13.apk
output -> output.outputFileName = "${defaultConfig.applicationId }_"+ buildType.name + "_v${defaultConfig.versionName}-${releaseTime()}.apk"
}
}
}
Android在Gradle文件中配置签名文件和APK的名称
最新推荐文章于 2022-07-14 17:02:30 发布