Gradle Script
app/build.gradle
flavorDimensions("market", "version")productFlavors {create("HUAWEI") {dimension = "market"manifestPlaceholders["market"] = name}create("HONOR") {dimension = "market"manifestPlaceholders["market"] = name}create("1_0_0") {dimension = "version"versionCode = 6000versionName = "1.0.0"manifestPlaceholders["version"] = versionName}create("2_0_0") {dimension = "version"versionCode = 7000versionName = "2.0.0"manifestPlaceholders["version"] = versionName}
}buildTypes {debug {manifestPlaceholders = []}
}variantFilter { variant ->if (variant.buildType.name.endsWith('release')) {variant.setIgnore(true)}
}applicationVariants.all { variant ->def market = variant.productFlavors.find { it.dimension == "market" }.namedef version = variant.productFlavors.find { it.dimension == "version" }.name.replaceAll("_", ".")variant.outputs.all { output ->output.outputFileName = "${market}-${version}.apk"}
}
Build Multiple Apks
Build - Generate Signed APK