I have and old android app that I am trying to migrate to the android gradle build system. The app is currently built in a multi project setup and published as four different apps (two different data sets included and free/paid versions for both datasets). I have managed to get away from the multi project setup by using flavorDimensions (previously called flavorGroups), but I can not figure out how to set a different applicationId for each flavor combination.
Since the app versions are already published, I need to keep the same applicationid as they currently have. Because of how my original package naming was done, I can not simply use flavor-buildtype combination with "packageNameSuffix" (which would have been a great option if it was an unpublished app).
https://stackoverflow.com/a/20956353/4177090 is answering how to use different source folders for flavor combinations, but not how (if even possible) to set specific configuration for each combination in the build file.
Gradle build file snippet:
flavorDimensions "price", "dataset"
productFlavors {
free { flavorDimension "price" }
paid { flavorDimension "price" }
dataset1 { flavorDimension "dataset" }
dataset2 { flavorDimension "dataset" }
}
I would like to have something like the following in my gradle build file (notice how unlogic my naming is, which is why I cannot use packageNameSuffix):
freeDataset1 { applicationId "com.beansys.freeappdataset1" }
freeDataset2 { applicationId "com.beansys.freedataset2" }
paidDataset1 { applicationId "com.beansys.dataset1paid" }
paidDataset2 { applicationId "com.beansys.mypaiddataset2" }
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…