Android Studio默认打包输出apk文件名为app-release或者app-debug,不便分类,所以需要对输出配置进行修改,使输出的apk带有版本信息和日期.
配置build.gradle
android.applicationVariants.all { variant ->
variant.outputs.each { output ->
def releaseTime = new Date().format("yyyy-MM-dd", TimeZone.getTimeZone("UTC"))
def file = output.outputFile
def filename = "Version_"+defaultConfig.versionName+"_"+releaseTime+".apk"
output.outputFile = new File(file.parent, filename)
}
}