I'm working on a white brand app.
We create a different flavor per client and each client has Debug
and Production
APIs, so I'm trying to set them up in the Gradle.
How should I do that?
Here is what I've tried:
buildTypes {
debug {
// some configurations
}
release {
// some configurations
}
}
flavorDimensions "client"
productFlavors {
company1{
dimension "client"
buildConfigField("String", "BASE_URL", "\"https://app.company1/devApi/\"")
}
company2 {
dimension "client"
buildConfigField("String", "BASE_URL", "\"https://app.company2/devApi/\"")
}
}
EDIT:
I would like to be able to define a different BASE_URL
per each Flavor and Buildtype.
Flavor company1, BuildType debug
https://app.company1.com/devApi/
Flavor company1, BuildType release
https://app.company1.com/prodApi/
Flavor company2, BuildType debug
https://dev.company2.com/api/
Flavor company2, BuildType release
https://prod.company2.com/api/
strings.xml
. Check my answer below and let me know if you have more questions. – Forney