Android Nexus 10 AOSP构建AndroidViewClient

时间:2013-06-28 21:15:15

标签: android automation monkeyrunner uiautomator androidviewclient

我终于成功构建了安装了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后端了吗?

1 个答案:

答案 0 :(得分: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。