Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- android {
- buildTypes {
- release {
- //批量修改apk名字
- applicationVariants.all { variant ->
- variant.outputs.all { output ->
- def outputFile = output.outputFile
- if (outputFile != null && outputFile.name.endsWith('.apk')) {
- //获取签名的名字
- variant.signingConfig.name
- //要被替换的源字符串
- def sourceFile = "-${variant.flavorName}-${variant.buildType.name}"
- //替换的字符串
- def replaceFile = "-v${variant.versionName}-${variant.flavorName}_${variant.buildType.name}"
- outputFileName = output.outputFile.name.replace(sourceFile, replaceFile);
- }
- }
- }
- }
- }
- flavorDimensions "color"
- productFlavors {
- xiaomi {}
- offical {}
- baidu {}
- googleplay {}
- qihu360 {}
- huawei {}
- sougou {}
- wangyi {}
- uc {}
- meizu {}
- ali {}
- wandoujia {}
- anzhishichang {}
- lianxiang {}
- yingyongbao {}
- oppo {}
- sametest {}
- }
- productFlavors.all {
- flavor -> flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name]
- }
- }
Add Comment
Please, Sign In to add comment