Search code examples
javaandroidappium

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


Solution

  • 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.