Testing Dynamic Feature Modules

Rishvik Vardhan
1 min readFeb 2, 2023

--

There two ways to test dynamic feature modules :

  1. Uploading app bundle to Internal Test Track in play console.
  2. Using Bundletool command-line tool to build your Android App Bundle and then test generating APKs from this app bundle. Let’s deep dive into it.

You can download bundletool from the GitHub repository.

Here are the steps to locally test dynamic feature module:

  1. Generate app bundle using android studio.
  2. Open terminal/cmd and navigate to downloaded bundletool and enter the following command to generate apk sets.
java -jar bundletool-all-1.13.2.jar build-apks --overwrite --local-testing 
--bundle=/MyApp/my_app.aab --output=/MyApp/my_app.apks

Specify the actual bundle and output path.

3. Open emulator or connect your testing device and then run the following command:

java -jar bundletool-all-1.13.2.jar install-apks --apks=/MyApp/my_app.apks

Specify the actual apk-set path that was generated in the previous step.

Now you can:

  • Request, monitor and cancel module installs.
  • Handle install errors.
  • Use SplitCompat to immediately access modules.
  • Use Play Core KTX (Kotlin extensions).

What’s not supported due to technical limitations (i.e. we have no current plans to add this):

  • Uninstalling modules.
  • Requesting deferred installs/uninstalls.
  • Starting a confirmation dialog for large modules.
  • More than one installation session running.

--

--