
我想使用自定义名称生成输出apk文件.例如.默认情况下,Android Studio会生成“ app-deBUG.apk”文件.但我希望它是-“ MyAppname_myCurrentProdFlavour_vMyVersionname.apk”
如何使用模块的build.gradle文件执行此 *** 作
解决方法:
您可以将以下机制分别用于调试和发行版本,这将允许您为每个版本提供不同的名称.
buildTypes { deBUG { MinifyEnabled false proguardfiles getDefaultProguardfile('proguard-androID.txt'), 'proguard-rules.pro' applicationVariants.all { variant -> variant.outputs.each { output -> project.ext { appname = 'MY-CUSTOM-APP' } def newname = output.outputfile.name newname = newname.replace("app-", "$project.ext.appname-") output.outputfile = new file(output.outputfile.parent, newname) } } signingConfig signingConfigs.MyApp } release { deBUGgable false jnIDeBUGgable false applicationVariants.all { variant -> variant.outputs.each { output -> project.ext { appname = 'MY-CUSTOM-APP' } def newname = output.outputfile.name newname = newname.replace("app-", "$project.ext.appname-") output.outputfile = new file(output.outputfile.parent, newname) } } signingConfig signingConfigs.MyApp MinifyEnabled true proguardfiles getDefaultProguardfile('proguard-androID.txt'), 'proguard-rules.pro' } }乐意效劳!!!
总结以上是内存溢出为你收集整理的如何在Android Studio中生成具有自定义名称的输出APK文件?全部内容,希望文章能够帮你解决如何在Android Studio中生成具有自定义名称的输出APK文件?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)