Studio自定義釋出APK 名字
阿新 • • 發佈:2018-12-30
最終的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檔名在android{}外新增//def fileName = "news7001.apk" def fileName ="test-"+releaseTime()+ "-" + buildType.name + "-v" + defaultConfig.versionName + "-" + defaultConfig.versionCode + ".apk" output.outputFile = new File(outputFile.parent, fileName) } } }
def releaseTime() { return new如果需要修改釋出名字 直接修改 def filenam = **** 就可以了。Date().format("yyyyMMdd", TimeZone.getTimeZone("UTC")) }
2、釋出程式
bulid->Genereta signed apk