我正在尝试使用monkey runner中的hierarchy-viewer来查看我的Android应用程序的布局。当我调用device.getHierarchyViewer()
方法时,我遇到了以下问题。
E/hierarchyviewer: String index out of range: 1155
130924 11:36:18.917:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] Script terminated due to an exception
130924 11:36:18.917:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]Traceback (most recent call last):
File "F:\python\testing.py", line 311, in <module>
pressButton ('id/action_bar_home_btn_area')
File "F:\python\testing.py", line 86, in pressButton
easy_device.touch(By.id(buttonID), MonkeyDevice.DOWN_AND_UP)
File "F:\python\testing.py", line 86, in pressButton
easy_device.touch(By.id(buttonID), MonkeyDevice.DOWN_AND_UP)
at com.android.chimpchat.hierarchyviewer.HierarchyViewer.findViewById(Hi
erarchyViewer.java:75)
at com.android.monkeyrunner.easy.By.findView(By.java:72)
at com.android.monkeyrunner.easy.EasyMonkeyDevice.getElementCenter(EasyM
onkeyDevice.java:219)
at com.android.monkeyrunner.easy.EasyMonkeyDevice.touch(EasyMonkeyDevice
.java:85)
at com.android.monkeyrunner.easy.EasyMonkeyDevice.touch(EasyMonkeyDevice
.java:81)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
java.lang.RuntimeException: java.lang.RuntimeException: Could not dump view
对此有任何帮助表示赞赏。
答案 0 :(得分:0)
您可以尝试 AndroidViewClient dump
:
usage: dump [OPTION]... [serialno]
Options:
-H, --help prints this help
-V, --verbose verbose comments
-I, --ignore-secure-device ignore secure device
-F, --force-view-server-use force view server use (even if UiAutomator present)
-S, --do-not-start-view-server don't start ViewServer
-k, --do-not-ignore-uiautomator-killed don't ignore UiAutomator killed
-w, --window=WINDOW dump WINDOW content (default: -1, all windows)
-i, --uniqueId dump View unique IDs
-x, --position dump View positions
-d, --content-description dump View content descriptions
-c, --center dump View centers