I have the follow situation
Part 1. An app working with Build Variants
: debug
, beta
and release
as follow
buildTypes {
debug {
versionNameSuffix '-DEBUG'
applicationIdSuffix '.debug'
buildConfigField "String", "SERVER_URL", '"url local test"'
debuggable true
signingConfig signingConfigs.config
}
beta {
versionNameSuffix '-BETA'
buildConfigField "String", "SERVER_URL", '"url homologation"'
signingConfig signingConfigs.config
}
release {
buildConfigField "String", "SERVER_URL", '"url production"'
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
}
And a call to use String SERVER_URL
pointing to current url by buildType selected
. Look this
String URL = BuildConfig.SERVER_URL
Part 2. The switch between Build Variants
by Android Studio, as follow image
It's working absolutelly fine for me
Part 1. I have the app on Google Play production generated as signed apk from release variant
Part 2. I need put the app on Google Play beta test generating as signed apk from BETA variant, e.g, pointing to url homologation
Part 3. When the product owner finish the tests from beta test, I go need promote the same app to production by Google Play Console
The core question: When I go promote the app from beta to production, it one will point automatically to url production
by release variant
or I will need generate another apk as signed apk from release variant
?
Why? The main motivation is beacause I can't test this promotion without safe assurance that it will work fine, and no less important, this would save my time and my own chef would can do it
Alert! If it is wrong job, what the best pratice to do it?
If I understand your question it is this:
You are right, this is a real problem. There are two common solutions:
Personally I think I would recommend option 1, but I know different large professional android developers use both options.