Anil Sisodiya
3 min readMay 21, 2019

Android Dynamic Delivery feature Testing

Google play store provides feature of delivering feature dynamically to user. Internally Google play store uses app bundles to deliver feature dynamically. it reduces application apk size and improve overall user experience. Application has main features bundle with apk and other feature downloaded on the fly as user requested for that. We can get multiple articles on the internet, which provides information about how to implement this feature in android apps. When I was trying out this feature I implemented this feature using information available on the internet as well as information available on android developer website, but I stuck during testing of this feature. I didn’t find any good article on internet , which provide detail information about testing this feature. This inspired me to write an story about testing dynamic delivery of feature.

We can test this feature by two ways.

  1. Google Play store :- To test this feature using Google Play Store we can create signed app bundle using Android Studio and then we can upload that app bundle in internal test track and then we can download app bundle using internal test track url. After downloading app bundle on device we can test dynamic feature. We can get option for generating app bundle in Android Studio (3.4 .1) using following sequence Main Menu ->Build ->Generate Signed Bundle/APK . This is easiest way to test dynamic features, but you should have google play store account. Just in case if we don’t have google play store account we can test this feature locally also.
  2. Testing using BundleTool :- BundleTool is underlying tool which is used by Google play store to deliver correct apk from app bundle to different devices with different cpu architecture. This tool also used by Android studio to generate apk from app bundle. We can use this tool to test dynamic feature locally. We need to perform following steps to test dynamic feature locally using Bundle Tool.

i) Download Bundle Tool from following url :- https://github.com/google/bundletool/releases

ii) Generate app bundle using Android Studio(3.4.1) using Main Menu->Build->Build Bundle(s)/APK(s). This will create app bundle in app(Base Module)->build->outputs->bundle->debug/release folder.

iii) Create a folder BundleTest and copy bundle tool jar which we downloaded in step 1. Also copy app bundle created in step number 2 in BundleTest folder. Generally app bundle file has extension .aab. Now open terminal on mac or command prompt in windows and navigate to BundleTest folder. Execute following command

java -jar bundletool-all-0.9.0.jar build-apks — bundle=/BundleTest/<bundle file( with .aab extension) — output=/BundleTest/<apk name with .apk extension> — ks=<path to keystore> — key-pass=pass:<key password> — ks-key-alias=<key store key alias> — ks-pass=pass:<key store password> — overwrite — mode=universal

Above command generate apk with given name and in this command option “overwrite — mode=universal” is the key which instruct to include dynamic feature in apk itself.

if we want to generate apk for connected device only then we can use following command, but this apk can not be used to test dynamic features locally.

java -jar bundletool-all-0.9.0.jar build-apks — connected-device — bundle=/BundleTest/<bundle file( with .aab extension) — output=/BundleTest/<apk name with .apk extension> — ks=<path to keystore> — key-pass=pass:<key password>— ks-key-alias=<key store key alias>— ks-pass=pass:<key store password>

iv) This is final step. Execute following command on terminal on mac or command prompt in windows.

java -jar bundletool-all-0.9.0.jar install-apks — apks=/BundleTest/<apk name with .apk extension>

Above command will install apk on your device and now you can test dynamic feature locally before uploading your app bundle on google play store to test dynamic feature.

That’s all for Today. If you like my story and find it useful, please hit on clap button. If you have any suggestion or comment please add that in comment section , I will reply whenever I get time.

Anil Sisodiya
Anil Sisodiya

Written by Anil Sisodiya

I am Software Architect with 18+ years of experience. I worked on many mobile application, which belong to various domain from scratch to production.

Responses (1)