bundletool is a tool for local testing android app bundle. It also can be used for testing offline dynamic delivery.
FakeSplitInstallManager will achieve testing offline dynamic delivery.
I will show an easy way to test offline dynamic delivery.
Usage FakeSplitInstallManager
It’s easy. It just use FakeSplitInstallManagerFactory instead of SplitInstallMangaerFactory.
FakeSplitInstallManagerFactory.create(
context,
context.getExternalFilesDir("local_testing")
)
The second argument is important for testing. You need to specify the directory which includes splits APK files. In the above code, it’s local_testing
in the app-specific file directory. local_testing
must not change because bundletool uses its name.
Usage bundletool
Downloading bundletool from Github release page.
See the document for details.
Generate a set of APKs
For using FakeSplitInstallManager, you need to add --local-testing
option.
$ bundletool build-apks --bundle=bundle.aab \
--output=app.apks \
--ks=keystore.jks \
--ks-pass=pass:store_password \
--ks-key-alias=key-alias \
--key-pass=pass:key_password \
--connected-device \
--local-testing
--local-testing
option is added since version 0.13.0.
Deploy APKs
$ bundletool install-apks --apks=app.apks
If you add --local-testing
when generating APKs, bundletool pushes apk files to thelocal_testing
directory on a connected device.
These apk files are used by FakeSplitInstallManager for testing offline dynamic delivery.
Finally, you launch your app and then execute a dynamic feature module installation. You can test without Google Play.
Conclusion
You can test offline dynamic delivery in 3 steps.
- Use FakeSplitInstallManager instead of SplitInstallMangaer.
- Generate a set of APKs with
--local-testing
option. - Deploy APKs.