习惯性伸手党区 UiAutomator died 错误

hukongli · 2015年06月18日 · 最后由 刘刘刘 回复于 2017年04月28日 · 1302 次阅读

在测试是遇到 UiAutomator died 错误,使用的真机 Android 是 4.2 版本 API=17,appium 1.3.4, ADT 的 API=19
log 信息如下

info: [debug] Device is at API Level 17
info: [debug] executing cmd: D:\appTest\adt-bundle-windows-x86-20131030\sdk\platform-tools\adb.exe -s 430b1b3c9780c000 shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n com.android.icredit/.StartLoadActivity"
info: [debug] Waiting for pkg "com.android.icredit" and activity ".StartLoadActivity" to be focused
info: [debug] Getting focused package and activity
info: [debug] executing cmd: D:\appTest\adt-bundle-windows-x86-20131030\sdk\platform-tools\adb.exe -s 430b1b3c9780c000 shell "dumpsys window windows"
info: [debug] Device launched! Ready for commands
info: [debug] Setting command timeout to the default of 60 secs
info: [debug] Appium session started with sessionId 9332d0e2-26dc-49f0-94b0-34a6fc23c7a7
info: <-- POST /wd/hub/session 303 9417.136 ms - 9
info: --> GET /wd/hub/session/9332d0e2-26dc-49f0-94b0-34a6fc23c7a7 {}
info: [debug] Responding to client with success: {"status":0,"value":{"platform":"LINUX","browserName":"","platformVersion":"4.1","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"automationName":"Android","deviceName":"430b1b3c9780c000","platformName":"Android","appActivity":".StartLoadActivity","browserName":"","appPackage":"com.android.icredit"},"automationName":"Android","deviceName":"430b1b3c9780c000","platformName":"Android","appActivity":".StartLoadActivity","appPackage":"com.android.icredit"},"sessionId":"9332d0e2-26dc-49f0-94b0-34a6fc23c7a7"}
info: <-- GET /wd/hub/session/9332d0e2-26dc-49f0-94b0-34a6fc23c7a7 200 2.289 ms - 645 {"status":0,"value":{"platform":"LINUX","browserName":"","platformVersion":"4.1","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"automationName":"Android","deviceName":"430b1b3c9780c000","platformName":"Android","appActivity":".StartLoadActivity","browserName":"","appPackage":"com.android.icredit"},"automationName":"Android","deviceName":"430b1b3c9780c000","platformName":"Android","appActivity":".StartLoadActivity","appPackage":"com.android.icredit"},"sessionId":"9332d0e2-26dc-49f0-94b0-34a6fc23c7a7"}
info: --> POST /wd/hub/session/9332d0e2-26dc-49f0-94b0-34a6fc23c7a7/element {"using":"name","value":"浼佷笟淇$敤鏌ヨ"}
warn: [DEPRECATED] The name locator strategy has been deprecated and will be removed. Please use the accessibility id locator strategy instead.
info: [debug] Waiting up to 0ms for condition
info: [debug] Pushing command to appium work queue: ["find",{"strategy":"name","selector":"浼佷笟淇$敤鏌ヨ","context":"","multiple":false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"name","selector":"浼佷笟淇$敤鏌ヨ","context":"","multiple":false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: find
info: [debug] [BOOTSTRAP] [debug] Finding 浼佷笟淇$敤鏌ヨ using NAME with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[DESCRIPTION=浼佷笟淇$敤鏌ヨ, INSTANCE=0]
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[TEXT=浼佷笟淇$敤鏌ヨ, INSTANCE=0]
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] Error in testRunServer:
info: [debug] [UIAUTOMATOR STDOUT] java.lang.NoClassDefFoundError: com.android.uiautomator.core.Configurator
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.AndroidElement.(AndroidElement.java:26)
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.AndroidElementsHash.addElement(AndroidElementsHash.java:47)
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.AndroidElementsHash.getElement(AndroidElementsHash.java:89)
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.handler.Find.fetchElement(Find.java:150)
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.handler.Find.execute(Find.java:90)
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.AndroidCommandExecutor.execute(AndroidCommandExecutor.java:64)
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.SocketServer.runCommand(SocketServer.java:168)
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.SocketServer.handleClientData(SocketServer.java:89)
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.SocketServer.listenForever(SocketServer.java:133)
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.Bootstrap.testRunServer(Bootstrap.java:16)
info: [debug] [UIAUTOMATOR STDOUT] at java.lang.reflect.Method.invokeNative(Native Method)
info: [debug] [UIAUTOMATOR STDOUT] at com.android.uiautomator.testrunner.UiAutomatorTestRunner.start(UiAutomatorTestRunner.java:144)
info: [debug] [UIAUTOMATOR STDOUT] at com.android.uiautomator.testrunner.UiAutomatorTestRunner.run(UiAutomatorTestRunner.java:87)
info: [debug] [UIAUTOMATOR STDOUT] at com.android.commands.uiautomator.RunTestCommand.run(RunTestCommand.java:90)
info: [debug] [UIAUTOMATOR STDOUT] at com.android.commands.uiautomator.Launcher.main(Launcher.java:83)
info: [debug] [UIAUTOMATOR STDOUT] at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
info: [debug] [UIAUTOMATOR STDOUT] at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:243)
info: [debug] [UIAUTOMATOR STDOUT] at dalvik.system.NativeStart.main(Native Method)
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stack=java.lang.NoClassDefFoundError: com.android.uiautomator.core.Configurator
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.AndroidElement.(AndroidElement.java:26)
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.AndroidElementsHash.addElement(AndroidElementsHash.java:47)
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.AndroidElementsHash.getElement(AndroidElementsHash.java:89)
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.handler.Find.fetchElement(Find.java:150)
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.handler.Find.execute(Find.java:90)
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.AndroidCommandExecutor.execute(AndroidCommandExecutor.java:64)
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.SocketServer.runCommand(SocketServer.java:168)
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.SocketServer.handleClientData(SocketServer.java:89)
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.SocketServer.listenForever(SocketServer.java:133)
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.Bootstrap.testRunServer(Bootstrap.java:16)
info: [debug] [UIAUTOMATOR STDOUT] at java.lang.reflect.Method.invokeNative(Native Method)
info: [debug] [UIAUTOMATOR STDOUT] at com.android.uiautomator.testrunner.UiAutomatorTestRunner.start(UiAutomatorTestRunner.java:144)
info: [debug] [UIAUTOMATOR STDOUT] at com.android.uiautomator.testrunner.UiAutomatorTestRunner.run(UiAutomatorTestRunner.java:87)
info: [debug] [UIAUTOMATOR STDOUT] at com.android.commands.uiautomator.RunTestCommand.run(RunTestCommand.java:90)
info: [debug] [UIAUTOMATOR STDOUT] at com.android.commands.uiautomator.Launcher.main(Launcher.java:83)
info: [debug] [UIAUTOMATOR STDOUT] at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
info: [debug] [UIAUTOMATOR STDOUT] at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:243)
info: [debug] [UIAUTOMATOR STDOUT] at dalvik.system.NativeStart.main(Native Method)
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] Test results for WatcherResultPrinter=.E
info: [debug] [UIAUTOMATOR STDOUT] Time: 9.089
info: [debug] [UIAUTOMATOR STDOUT] FAILURES!!!
info: [debug] [UIAUTOMATOR STDOUT] Tests run: 1, Failures: 0, Errors: 1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1
info: [debug] UiAutomator exited

共收到 6 条回复 时间 点赞

你的意思是必须>=4.3 才可以吗

对的,>=4.3 才行,4.2 不行。
具体情况可以参考 UIAutomator 在 API level = 17 (4.2) 上的问题

添加头像。。。

谢谢,

@Lihuazhang 问一下,请问下为啥我这边用 python+uiautomator 操作不了 7.0 的,但可以操作 6.0 的。看 log 后说是什么 write failed epipe.python 报错的是 ioerror Rpc server not started

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册