Reputation: 54781
android {
flavorDimensions 'app', 'region'
productFlavors {
app1 {
dimension 'app'
}
app2 {
dimension 'app'
}
europe {
dimension 'region'
}
asia {
dimension 'region'
}
}
Now I need:
app1Europe
to have application id of com.w
app2Europe
to have application id of com.x
app1Asia
to have application id of
com.y
app2Asia
to have application id of com.z
I can't see a place that will allow me to specify the applicationId
per for the flavor combination.
Note: As the client app store listings already exist, I can't have one listing for these multiple regions. There really isn't any common prefix among the application ids beyond com.
Upvotes: 2
Views: 319
Reputation: 1004
android.applicationVariants.all { variant ->
def mergedFlavor = variant.mergedFlavor
switch (variant.flavorName) {
case "app1Europe":
mergedFlavor.setApplicationId("com.w")
break
case "app2Europe":
mergedFlavor.setApplicationId("com.x")
break
case "app1Asia":
mergedFlavor.setApplicationId("com.y")
break
case "app2Asia":
mergedFlavor.setApplicationId("com.z")
break
}
}
Inspired by https://stackoverflow.com/a/28044024/2545800
Upvotes: 4