0

我终于成功地构建了一个安装了 Google 移动服务的 Nexus 10 映像 (full_manta-userdebug),但不幸的是,我无法使用使用 AndroidViewClient 的 MonkeyRunner 脚本。它从脚本中崩溃,内容如下:

/system/bin/sh: uiautomator: not found


130628 14:12:41.242:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions] Script terminated due to an exception
130628 14:12:41.242:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions]Traceback (most recent call last):
  File "/home/allen/projects/cts-scripts/4.2/cts-setup.py", line 361, in <module>
    main()
  File "/home/allen/projects/cts-scripts/4.2/cts-setup.py", line 339, in main
    vc = ViewClient(device, serialno)
  File "/home/allen/projects/AndroidViewClient/AndroidViewClient/src/com/dtmilano/android/viewclient.py", line 1188, in __init__
    self.dump()
  File "/home/allen/projects/AndroidViewClient/AndroidViewClient/src/com/dtmilano/android/viewclient.py", line 1780, in dump
    self.setViewsFromUiAutomatorDump(received)
  File "/home/allen/projects/AndroidViewClient/AndroidViewClient/src/com/dtmilano/android/viewclient.py", line 1530, in setViewsFromUiAutomatorDump
    self.__parseTreeFromUiAutomatorDump(received)
  File "/home/allen/projects/AndroidViewClient/AndroidViewClient/src/com/dtmilano/android/viewclient.py", line 1688, in _ViewClient__parseTreeFromUiAutomatorDump
    self.root = parser.Parse(receivedXml)
  File "/home/allen/projects/AndroidViewClient/AndroidViewClient/src/com/dtmilano/android/viewclient.py", line 988, in Parse
    parserStatus = parser.Parse(uiautomatorxml, 1)
  File "/home/allen/android/android-sdks/tools/lib/jython-standalone-2.5.4-rc1.jar/Lib/xml/parsers/expat.py", line 212, in Parse
xml.parsers.expat.ExpatError: Content is not allowed in prolog.

我是否需要安装 ViewServer 才能正常工作,还是在构建映像时忘记包含 uiautomator 后端?

4

1 回答 1

1

尝试uiautomator从命令行找出它是否存在:

$ adb shell uiautomator

如果您的输出类似于

Usage: uiautomator <subcommand> [options]

Available subcommands:

help: displays help message
...

那么你已经uiautomator安装了。否则,如果输出是

/system/bin/sh: uiautomator: not found

然后您忘记将其包含在图像中。

如果 UiAutomator 用作 AndroidViewClient 后端,则不需要 ViewServer。

于 2013-06-29T03:37:52.213 回答