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

拟墨画扇 提交于 2019-12-24 00:06:02

问题


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


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/36383008/activity-used-to-start-app-doesnt-exist-cannot-open-calculator-app-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!