Start android session

I would like to start android session without app providing, then ask if app is installed and only when app is not installed with the same version/code I would like to install it.

Unfortunately, appium requires either package and activity or app file, so I cannot create just session and run isAppInstalled.

Another issue is that isAppInstalled accepts only bundleId and not version, not sure if it is even usable for android. So currently if I want to ensure that there is the same version of the app that I need I have to reinstall the app every test start ?

Concerning starting the session without app the issue is not in the java client but in the server itself
at AndroidDriver.validateDesiredCaps (…/…/lib/driver.js:446:11)


Why not to reinstall app only with first test and continue without reinstall with all others?

We have probably different use case than you and in our case we cannot know if the next test should be on the same app version as the previous one.

use aapt to check app version before you install it , ofcourse should be done before session creation

We have disabled automatically starting the app by setting the auto_launch capability to false. This also causes Appium not to install the app, so we control that ourselves. We query the app version by keeping track of which apk we installed and using aapt to extract the version number from it. We provide the package and activity in the capabilities, but since we control when it’s launched, that’s not a problem. Because we haven’t changed those two values over our different version of the app, we have no problem there, but since we also launch other apps during our testing, we have built a function to start the apps for us, and if we had different app package names and activities, we could handle that ourselves.

1 Like

Thank you, will have a look at auto_launch and aapt

1 Like