You can create a BuildConfig Field to provide different REST API URL based on your product flavors to your API client:
Open your build.gradle (app level) file and add the following lines to your android block:
android {
....
applicationVariants.all { variant ->
def variantName = variant.flavorName
// replace your specific flavor here instead of 'flavor1' & 'flavor2'
if (variantName.contains("flavor1")) {
variant.buildConfigField 'String', "SERVER_URL", '"your_flavor_specific_url_here"'
} else if (name.contains("flavor2")) {
variant.buildConfigField 'String', "SERVER_URL", '"your_flavor_specific_url_here"'
}
}
....
}
Now Rebuild your project and then you can access BuidConfig.SERVER_URL
in your project which will differ based on your product flavor you've selected.