Install prerequisite apk’s in your Appium Android Tests

When running an Android test, you can install an apk on your Android device/emulator using the app capability. But what if there is one or more other apk’s that you wish to install during that session?

With Appium 1.8, we’re introducing a new capability called otherApps which lets you specify one or more other apk’s to be installed alongside the main apk.

To install just one other apk:

driver.setCapability("otherApps", "/path/to/app.apk")

To install more than one other apk, provide a JSON array containing a list of apk’s:

driver.setCapability("otherApps", "[\"/path/to/app-a.apk\", \"/path/to/app-b.apk\"]")

This won’t work:

driver.setCapability("otherApps", "['/path/to/app-a.apk', '/path/to/app-b.apk']")

The otherApps capability expects a JSON array and "['/path/to/app-a.apk', '/path/to/app-b.apk']" is not valid JSON because it contains single quotes (visit https://jsonlint.com/ to learn about JSON and use their JSON validator)