appium Activity used to start … - 51ste软件测试部落-中国软件测试者的乐园
登录|注册

appium Activity used to start app doesn't exist or cannot be launched 问题解决?

楼主 stady发布于:2018/03/30

运行appium测试报错 “error: Failed to start an Appium session, err was: Error: Activity used to start app doesn’t exist or cannot ve launched! Make usre it exists and is launchable activity

最佳答案 #1楼 daigua回复于:2018/03/30

网上很多说法是:“要打开的activity不存在,activity路径错误,改为完整正确的activity路径”
仔细检查了好几遍发现,activity是存在的,activity路径也是正确的(当然这么低端的问题一般人也不会犯)
经过一番查找,问题解决如下:
注释掉setup中的如下两行:
capabilities.setCapability("appPackage", "xxx.xxx.xxx.activity");
capabilities.setCapability("appActivity", ".MainActivity");

再次运行,问题解决了。
说明:说明运行测试的时候我们不需要指定package和activity 这些信息,Appium会从apk中提取这些信息。
见:https://github.com/appium/appium/issues/2981 中paymand  的解释:
Don't know about the apk info tool above, but you can always get that info using the aapt tool from Android SDK with the following command:
adt/sdk/build-tools/android-4.4/aapt dump badging app.apk
Note: You shouldn't need to specify appPackage, appActivity, etc. since Appium should be able to extract those from the apk using the method above anyway.

回复