-
-
Save fei-ke/9067bf303d48f5f498b1 to your computer and use it in GitHub Desktop.
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