In my Android application I have two flavor dimensions: "brand" (brand1, brand2) and "environment" (staging, production).
I added the "environment" dimension after a while and I had previously defined some BuildConfig
variables for the different brands. To be more specific, I defined the BASE_URL
like this:
flavorDimensions 'brand'
productFlavors {
brand1 {
dimension 'brand'
...
buildConfigField "String", "BASE_URL", "\"http://brand.one.api/\""
...
}
brand2 {
dimension 'brand'
...
buildConfigField "String", "BASE_URL", "\"http://brand.two.api/\""
...
}
}
Now, I added the "environment" dimension and what I'd like to set are four different endpoints:
- Brand1-staging: "http://brand.one.staging.api/"
- Brand1-production: "http://brand.one.production.api/"
- Brand2-staging: "http://brand.two.staging.api/"
- Brand2-production: "http://brand.two.production.api/"
But I can't figure out how to create a BuildConfig
variable for a specific combination of flavor dimensions. Is this even possible with bare gradle?
Thanks