各位,最经使用monkeyrunner做自动测试,发现在模拟器里边能够响应的脚本命令,在真机里失败
  如:  >>> device.press('KEYCODE_BACK',MonkeyDevice.DOWN_AND_UP)
111128 17:02:51.308:S [main] [com.android.chimpchat.adb.AdbChimpDevice] Error se
nding press event: KEYCODE_BACK DOWN_AND_UP
111128 17:02:51.308:S [main] [com.android.chimpchat.adb.AdbChimpDevice]java.net.
SocketException: Software caused connection abort: socket write error   而这在模拟器里是没有问题的。有人给解释下。

解决方案 »

  1.   

    device 是连接到真机的,如device.startActivity()这样的又能响应。
      

  2.   

    用3.2SDK的monkeyrunner。可以发我邮件交流[email protected]
      

  3.   

    sdk tools rev15
    adk platform-tools rev9
      

  4.   

    朋友,我最近在学习使用monkey runner进行测试,遇到和你一样的问题,请问是如何解决的啊,谢谢
      

  5.   

    请教下,我明明手机连接成功了,为device.startActivity()运行了没有反应呢,能告诉我原因吗...
      

  6.   

    04:49:31 E/hierarchyviewer: Unable to get view server version from device 015EF4
    5B0E01A008
    04:49:31 E/hierarchyviewer: Unable to get view server protocol version from devi
    ce 015EF45B0E01A008
    04:49:33 E/hierarchyviewer: Unable to debug device 015EF45B0E01A008
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    java.lang.RuntimeException: Could not connect to the view server
            at com.android.chimpchat.hierarchyviewer.HierarchyViewer.setupViewServer
    (HierarchyViewer.java:56)
            at com.android.chimpchat.hierarchyviewer.HierarchyViewer.<init>(Hierarch
    yViewer.java:42)
            at com.android.chimpchat.adb.AdbChimpDevice.getHierarchyViewer(AdbChimpD
    evice.java:96)
            at com.android.monkeyrunner.easy.EasyMonkeyDevice.<init>(EasyMonkeyDevic
    e.java:64)
            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
    orAccessorImpl.java:57)
            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
    onstructorAccessorImpl.java:45)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
            at org.python.core.PyReflectedConstructor.make(PyReflectedConstructor.ja
    va:67)
            at org.python.core.PyJavaType$1.new_impl(PyJavaType.java:475)
            at org.python.core.PyType.invoke_new_(PyType.java:432)
            at org.python.core.PyType.type___call__(PyType.java:1374)
            at org.python.core.PyType.__call__(PyType.java:1365)
            at org.python.core.PyObject.__call__(PyObject.java:397)
            at org.python.core.PyObject.__call__(PyObject.java:401)
            at org.python.pycode._pyx13.f$0(<stdin>:1)
            at org.python.pycode._pyx13.call_function(<stdin>)
            at org.python.core.PyTableCode.call(PyTableCode.java:165)
            at org.python.core.PyCode.call(PyCode.java:18)
            at org.python.core.Py.runCode(Py.java:1197)
            at org.python.core.Py.exec(Py.java:1241)
            at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:147)
            at org.python.util.InteractiveInterpreter.runcode(InteractiveInterpreter
    .java:89)
            at org.python.util.InteractiveInterpreter.runsource(InteractiveInterpret
    er.java:70)
            at org.python.util.InteractiveInterpreter.runsource(InteractiveInterpret
    er.java:46)
            at org.python.util.InteractiveConsole.push(InteractiveConsole.java:110)
            at org.python.util.InteractiveConsole.interact(InteractiveConsole.java:9
    0)
            at org.python.util.InteractiveConsole.interact(InteractiveConsole.java:6
    0)
            at com.android.monkeyrunner.ScriptRunner.console(ScriptRunner.java:193)
            at com.android.monkeyrunner.MonkeyRunnerStarter.run(MonkeyRunnerStarter.
    java:73)
            at com.android.monkeyrunner.MonkeyRunnerStarter.main(MonkeyRunnerStarter
    .java:189)java.lang.RuntimeException: java.lang.RuntimeException: Could not connect to the
     view server
      

  7.   

    手机一般不支持from com.android.chimpchat.hierarchyviewer import HierarchyViewer
    from com.android.hierarchyviewerlib.device import ViewNode需要root权限