Appium:UiAutomator意外退出,代码为0,信号为null

时间:2017-05-09 05:08:13

标签: java appium

Appium版本:1.6.4-beta

Appium服务器抛出以下异常:

Caused by: org.openqa.selenium.remote.SessionNotFoundException: A session is either terminated or not started (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 22 milliseconds
os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.6', java.version: '1.8.0_121'
Driver info: io.appium.java_client.android.AndroidDriver

I see following in appium server log:
UiAutomator] UiAutomator exited unexpectedly with code 0, signal null
[debug] [UiAutomator] Moving to state 'stopped'
[debug] [AndroidDriver] Shutting down Android driver
[Appium] Closing session, cause was 'UiAUtomator shut down unexpectedly'
[Appium] Removing session 1865dd4e-ed7e-431a-8233-0227173400a5 from our master session list

我不明白为什么UiAutomator会退出。非常感谢任何帮助。

2 个答案:

答案 0 :(得分:1)

此错误看起来就像进程com.android.commands.monkey正在运行时一样。在我杀了它后,appium正常运行测试。 要杀死它,只需运行:

adb shell ps | grep com.android.commands.monkey | awk '{print $2}' | xargs adb shell kill -9

答案 1 :(得分:0)

我也看到了同样的问题 UiAutomator] UiAutomator意外退出,代码为0,信号为空 [调试] [UiAutomator]移至“已停止”状态

但是原因是我的设备已断开连接,当我再次连接它时,它的工作正常。 基本上,UiAutomator会查找设备和应用程序屏幕,如果未显示,则显示为Appium服务器控制台中的错误。