appium inspector报错Cannot start the ‘xx’ application; Command output: Error: Intent matches multiple activities
这个问题 在我安装使用 appium inspector的时候卡了一小段时间,下面给大家说说我的问题,最终怎么解决了的
对于没有操作过的朋友来说 似乎不知道是什么问题,网上搜索的 尝试的也是模棱两可的,有点卡时间,我遇到的上面这个问题 如下图:
报错的原始内容如下:
Failed to create session. An unknown server-side error occurred while processing the command. Original error: Cannot start the ‘com.hpbr.bosszhipin’ application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Error executing adbExec. Original error: ‘Command ‘/Users/a0/Library/Android/sdk/platform-tools/adb -P 5037 -s 238800ac2c017ece shell am start -W -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000’ exited with code 1’; Command output: Error: Intent matches multiple activities; can’t stop: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 }
首先提示的一点:下面的Automatically add necessary Appium vendor prefixes on start 这个选择框如果不勾选的话,是不会自动填充前缀的,运行也会报异常,即勾选了前缀,就可以直接配置各种参数 platformName、deviceName ….之类的,不勾选的话,要加上对应的前缀,比如 “appium:” 这个默认勾选不动就好了。
ANDROID_HOME JAVA_HOME已配置好。 下面再看我遇到的这个主要报错问题,我直接说解决结果吧,经过几次上网查资料等等,最终发现 连接android 设备时候的参数少加了一个 appActivity ,最终把appPackage、appActivity 参数正确配置上就正常打开了。示例如下。
1
2
3
4
5
6
7
{
"appium:platformName": "Android",
"appium:deviceName": "238800ac2c017ece",
"appium:appPackage": "com.douguo.recipe",
"appium:platformVersion": "10.0",
"appium:appActivity": "com.douguo.recipe.HomeActivity"
}
如果你不知道 appPackage、appActivity 这两个参数值是从哪里来的,可以网上看一下,当然可以看我另一个文章,获取方式有好几种,我喜欢用的是这种