一,打包方式使用IDE菜单选项
二、在app级别的build.gradle下配置:
static def releaseTime() {
return new Date().format("yyyyMMdd.kkmm", TimeZone.getTimeZone("GMT+8"))
}
android.applicationVariants.all { variant ->
println('============')
println(variant.name)
variant.outputs.each { output ->
def file = output.outputFile
output.outputFileName = file.name.replace(".apk", "-xxxx-${variant.versionName}-${variant.versionCode}-${releaseTime()}.apk")
println(output.outputFileName)
}
}