Created
December 4, 2014 19:35
-
-
Save fredgrott/361db859908f759bc28f to your computer and use it in GitHub Desktop.
rename android app apk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in your android.applicationVariants.all { variant -> | |
// or in your android.libraryVariants.all { variant -> | |
// code block put this: | |
if (variant.productFlavors[0] == null){ | |
variant.outputs[0].outputFile = new File(variant.outputs[0].outputFile.parent, | |
project.ext.ourProjectName + "_" | |
+ variant.buildType.name + "_" | |
+ android.defaultConfig.versionCode + "_" | |
+ android.defaultConfig.versionName + ".apk") | |
}else{ | |
variant.outputs[0].outputFile = new File(variant.outputs[0].outputFile.parent, | |
project.ext.ourProjectName + "_" | |
+ variant.productFlavors[0].name + "_" | |
+ variant.buildType.name + "_" | |
+ variant.mergedFlavor.versionCode + "_" | |
+ variant.mergedFlavor.versionName + ".apk") | |
} | |
//works for all use cases: | |
// app without productFlavors | |
// app with productFlavors and even flavorDimensions | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment