How to split Android project for QA version

Lee young-jun
3 min readSep 21, 2021

--

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 ‘.qapackage_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.

Congratulation!!

You have QA Version app with new app name and icon.

References

https://www.google.co.kr/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&ved=2ahUKEwjWlsqguIzzAhWSO5QKHSzhARUQFnoECA4QAQ&url=https%3A%2F%2Fdeveloper.android.com%2Fstudio%2Fbuild%2Fbuild-variants%3Fhl%3Dko&usg=AOvVaw0nJ4hi8Ia2a3eONoBMBZPC

https://www.google.co.kr/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&cad=rja&uact=8&ved=2ahUKEwi5yOKbqY3zAhXlxIsBHQ-yBPkQFnoECAMQAQ&url=http%3A%2F%2Fblog.logicwind.com%2Fadding-multiple-target%2F&usg=AOvVaw2F_FqT9WwFn2XIXD7BI410

https://pancake.coffee/2018/04/27/product-flavor%EC%97%90-%EB%94%B0%EB%9D%BC-google-services-json-%ED%8C%8C%EC%9D%BC-%EB%94%B0%EB%A1%9C-%EC%A0%81%EC%9A%A9%ED%95%98%EA%B8%B0/

--

--

No responses yet