使用appium启动app的时候Error: The instrumentation process cannot be initialized. Make sure the applica的解决办法

前言:昨天使用python运行代码启动模拟器app的时候还是正常的,今天就发现appium报错Error: The instrumentation process cannot be initialized. Make sure the application under test does not crash and investigate the logcat output.,这个错误在appium和python控制台都会出现在这里插入图片描述

1、方案一,没解决

在appium中还出现了 Did not get confirmation UiAutomator2 deleteSession worked; Error was: UnknownError: An unknown server-side error occurred while processing the command. Original error: 'DELETE /' cannot be proxied to UiAutomator2 server because the instrumentation process is not running (probably crashed). Check the server log and/or the logcat output for more details错误
这个错误网上有个解决办法是把python代码中UiAutomator2改为UiAutomator1

'automationName': 'UiAutomator1'

但是还是不行,然后网上找了很多办法,都不行,然后我放弃了

2、方案二,成功解决

最后还是在appium中从开始的日志往下翻,终于翻到了一个错误
sha256 hash did match for 'appium-uiautomator2-server-v4.24.0.apk
后面去百度搜索这个,有过解释是说重复安装了appium-uiautomator2-server服务,建议在启动的时候加上下面的代码

'skipServerInstallation': True
'skipDeviceInitialization': True

但是还是不行,然后我一想了想我最近的一些操作,确实有过安装uiautomator2,然后看了一下模拟器的界面,发现多了一个app,然后把这个app删除,重新运行代码,就成功了

方法1、就是下面这个app,这个是我在进行获取模拟器中app的元素,运行weditor的时候自动安装的,我们把这个删除掉,问题就都解决了
在这里插入图片描述

方法2、后面我们还需要定位又会安装,这个时候来来回回不方便,我没打开app,然后点击“停止ATXAGENT”按钮或者点击“停止UIAUTOMATOR”按钮就可以了
在这里插入图片描述

如果想要了解app怎么获取定位的话,可以到http://heitree.xyz/看看

小结:有的时候还是要自己去看日志,找报错原因,特别是当在网上找了很多解决办法无法解决的时候,这个只能靠自己去看日志,加油!!!

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
THE END
分享
二维码
< <上一篇
下一篇>>