I have a number of flavors in my app, and I want to set a boolean buildConfigField for a subset of them. Is there a way to avoid having to add the field to every flavor? Ideally my build.gradle would look like the following:
productFlavors {
flavor1 {
}
....
flavor4 {
buildConfigField "boolean", "DISABLE_SOMETHING", "true"
}
flavor5 {
buildConfigField "boolean", "DISABLE_SOMETHING", "true"
}
....
flavor8 {
}
}
So in my app I can just go
if (BuildConfig.DISABLE_SOMETHING) {
//disable stuff
}
However, compilation fails when I try to build with, for example, flavor1
, as it can't find the field. I don't want to have to remember to add this to every new flavor I create. Are there any ways around this?