I have created 4 different flavours in build variants in my app. I have added version and suffix in the configuration in my app's build.gradle.. Below is the code:
productFlavors {
qa {
applicationIdSuffix ".qa"
versionCode 1
versionName "1.0"
//manifestPlaceholders = [application: ".utils.Application"]
}
demo {
applicationIdSuffix ".demo"
versionCode 1
versionName "1.0"
//manifestPlaceholders = [application: ".utils.Application"]
}
dev {
versionCode 1
versionName "1.0"
//manifestPlaceholders = [application: ".utils.Application"]
//signingConfig signingConfigs.release
}
uat {
applicationIdSuffix ".uat"
versionCode 1
versionName "1.0"
//manifestPlaceholders = [application: ".utils.Application"]
}
}
In my app, I use a file APIAddresses.java for selecting the URLs to hit according to the environment. Is there any way I can use only this file out of all the source code in build.gradle only to configure URLs for build variants?
May be create different copies of this file for each build variant, something similar to this.
productFlavors {
qa {
applicationIdSuffix ".qa"
versionCode 1
versionName "1.0"
APIAddresses_QA
}
demo {
applicationIdSuffix ".demo"
versionCode 1
versionName "1.0"
APIAddresses_DEMO
}
}
Thank you!