How to split Android project for QA version
Few weeks ago, kickgoing team was asked to make QA version from UX team.
They want to test new version without uninstalling previous version.
To keep previous version of your app, you should change application id.
I will show you how it is.
Application ID Suffix
When your application id is like this
defaultConfig {
applicationId "com.kickgoing"
...}
You can make QA version by attaching ‘qa’ to applicationId
applicationId "com.kickgoing.qa"
But you should modify applicationId every time QA Publishing.
So you want to simply switching configuration when publishing.
You can see buildTypes in bundle.gradle like this
buildTypes {
release {
... }
debug {
... }}
Input this line in debug block
applicationIdSuffix ".qa"
Now you can install qa version without uninstalling!
google-services.json
However if you use any google services(like firebase), you should modify it.
open app/google-services.json and modify package_name
{“client_info”: {“mobilesdk_app_id”: “1:20597037644:android:7f7b3bcc86bb89f1”,“android_client_info”: {“package_name”: “com.kickgoing.qa”
But this is manual task…
Flavor
We run installDebug to install app.
So you might want something like installQADebug to install QA version.
How it is possible?
Google provides ProductFlavor to achieve it.
Add this lines in android block of your app/bundle.gradle.
flavorDimensions "default"
productFlavors {
live {
}
qa {
applicationIdSuffix ".qa"
}
}
google-services.json
If you use any google services, copy app/google-services.json to app/src/qa/google-services.json
And attach ‘.qa’ package_name
Now you can run installQADebug!!
Alias
Congratulation! however if you need to run installDebug(for like yarn android…)
you need make task installDebug
Add this lines in your app/bundle.gradle.
task installDebug() {
tasks.findByName('installDebug')
.dependsOn('installLiveDebug')
}
task installRelease() {
tasks.findByName('installRelease')
.dependsOn('installLiveRelease')
}
When you try to run installDebug, installLiveDebug will be running.
How ever you can’t find installDebug from gradlew tasks.
strings.xml
You can see your live and qa apps like this
Can you which one is QA Version??
see your AndroidManifest.xml — app/src/main
<application android:name=".MainApplication" android:label="@string/app_name"
To change your app name, you should modify app_name in strings.xml
Copy app/src/main/res/values/strings.xml to app/src/qa/res/values/strings.xml.
Open it and modify app_name value in resources like this
<resources> <string name="app_name">테스트킥</string> ...</resources>
Now you find which one is QA version!!!
Icon
You may want set new icon for QA.
You have probably seen android:icon when opening AndroidManifest.xml.
<application android:icon="@mipmap/ic_launcher"
You can see icon use mipmap/ic_launcher resource.
Find all resource directory startsWith mipmap_ in app/src/main/res.
Copy all ic_launcher.png to app/src/qa/res with owner directories. like this
You have to copy ic_launcher_xxx(ic_launcher_round, ic_launcher_foreground) also if new icon is not appeared.