Android(安卓)studio 打包apk如何重命名apk名称
16lz
2021-12-04
在打包签名之前,在相应的module的build.gradle中添加如下代码
<pre name="code" class="java"> applicationVariants.all { variant -> variant.outputs.each { output -> def oldFile = output.outputFile def newName = 'luckpan'; if (variant.buildType.name.equals('release')) { // println(variant.productFlavors[0].name) def releaseApkName = 'study-' + defaultConfig.versionName + '-luckpan.apk' output.outputFile = new File(oldFile.parent, releaseApkName) } if (variant.buildType.name.equals('beta')) { newName = oldFile.name.replace(".apk", "-v" + defaultConfig.versionName + "-build" + getDate() + ".apk") output.outputFile = new File(oldFile.parent, newName) } if (variant.buildType.name.equals('debug')) { } } }
更多相关文章
- NPM 和webpack 的基础使用
- Android(安卓)(ListActivity、Contextmenu)微信类消息置顶和删除和
- 为什么在AndroidManifest.xml中Activity的theme用不了Theme.Ligh
- Android中的Bundle类
- Android(安卓)library projects cannot be launched
- Android(安卓)Kotlin开发模块之间跳转-ARouter
- Android(安卓)Bundle类
- android RN 配置和打包命令
- Android百度地图一种简单实现多标注及响应时间的方法