CodeJockey
CodeJockey

Reputation: 433

Activity used to start app doesn't exist (Cannot open Calculator app in Android 5.1.1)

I'm really new to Appium so excuse me if its a repeat question. But, I'm trying to run some tests on the calculator app on Android 5.1.1 using Appium and it results in the following error.

error: Failed to start an Appium session, err was: Error: Activity used to start app doesn't exist or cannot be launched! Make sure it exists and is a launchable activity

info: [debug] Error: Activity used to start app doesn't exist or cannot be launched! Make sure it exists and is a launchable activity

Test Code (capabilities):

capabilities.setCapability("appPackage", "SecCalculator2");
capabilities.setCapability("appActivity", "com.sec.android.app.popupcalculator.Calculator");

I have downloaded the 'APK info' app on my phone and this app shows the following info.

APK path: /system/app/SecCalculator2/SecCalculator2.apk

Activities: com.sec.android.app.popupcalculator.Calculator

So am I using the correct package and activity names in the capabilities?

Thanks in advance

Upvotes: 2

Views: 3230

Answers (2)

Sadik Ali
Sadik Ali

Reputation: 1205

You should add app file name in desired capabilities like below:

capabilities.setCapability("app", "/system/app/SecCalculator2/SecCalculator2.apk"); 

Also you can skip to add "appPackage" and "appActivity" Appium automatically launch application which is mentioned in apk file.

Hope this will help you.

Upvotes: 4

Naman
Naman

Reputation: 32036

You can correct the appPackage as following :

capabilities.setCapability("appPackage", "com.sec.android.app.popupcalculator");

Assuming mostly the activity names are prefixed with the package name.

Edit : Your logs read incorrect activity name. So probably sometimes the name is provided using a / which would also be mentioned in the appium server logs.

Upvotes: 2

Related Questions