Android App Bundle (.aab)
The UiAutomator2 driver supports the Android App Bundle
feature. This feature allows generating an .aab file, which is meant for uploading to the Google
Play Store.
Generating the App Bundle¶
An .aab file can be managed via CLI using the official bundletool,
which is available from Google's GitHub repo.
Google's App Bundle guide can also help
understand the feature.
Running Tests¶
Before testing with Appium, the .aab file should be converted to an .apks file. Appium added
support for .apks files in these PRs.
- Ensure
bundletool.jaris available in PATH- Appium will look for
bundletool.jar. Ensure the path can be found withwhich 'bundletool.jar'. - bundletool version should be above 1.6.0
- Appium will look for
-
Generate the
.apksfile from the.aabfile.aabis available since Android Studio 3.2- Generating
.apksfrom.aabrequires app signing
$ java -jar apks/bundletool.jar build-apks \ --bundle apks/release/release/app.aab \ # Path to the input .aab file --output apks/AppBundleSample.apks \ # Path to the .apks file --ks apks/sign \ # Signing keystore --ks-key-alias key0 \ # Alias of the keytstore --ks-pass pass:kazucocoa \ # Password of the keystore --overwrite # Overwrite any existing apks files -
Use the path to the
.apksfile in theappium:appcapability.
The .apks bundle can also be installed using mobile: installApp:
Tips¶
Make bundletool.jar executable¶
This can be done by running chmod 655 /path/to/bundletool.jar, for example.
Test with different languages¶
Set appium:fullReset to true if testing the app with
different language resources.
Appium only installs the minimum set of resources, following the behavior of the appbundle feature.
For example, if a device's language is set of English, Appium will only install the en resource,
with any other languages being absent.