最终的apk格式为 test-20170630-release-v1.0-1.apk
1 、修改build.grade
在android{}内添加
android.applicationVariants.all { variant -> variant.outputs.each { output -> def outputFile = output.outputFile if (outputFile != null && outputFile.name.endsWith('.apk')) { //这里修改apk文件名 //def fileName = "news7001.apk" def fileName ="test-"+releaseTime()+ "-" + buildType.name + "-v" + defaultConfig.versionName + "-" + defaultConfig.versionCode + ".apk" output.outputFile = new File(outputFile.parent, fileName) } } }在android{}外添加
def releaseTime() { return new Date().format("yyyyMMdd", TimeZone.getTimeZone("UTC")) }如果需要修改发布名字 直接修改 def filenam = **** 就可以了。
2、发布程序
bulid->Genereta signed apk