Monkeyrunner下运行press提示Error sending press event
我的环境:Ubuntu10.04
Jython : 2.5.0
android-sdk-linux_x86_2.3(tools_r13-linux,platform-tools_r07-linux)
真机 MOPST800 (android2.3.4)
cd /home/validation/gongju/gb/android-sdk-linux_x86_2.3/tools
monkeyrunner
显示Jython 2.5.0 (Release_2_5_0:6476, Jun 16 2009, 13:33:26)
[Java HotSpot(TM) Client VM (Sun Microsystems Inc.)] on java1.6.0_22
单步运行下列语句正确。
>>> from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice, MonkeyImage
>>> device = MonkeyRunner.waitForConnection()
>>> device.installPackage('./ApiDemos.apk')
True
>>> device.startActivity(component='com.example.android.apis/.ApiDemos')
单步运行下句出错(100%)。
>>> device.press('KEYCODE_MENU','DOWN_AND_UP')
提示如下:
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] Error sending press event: KEYCODE_DPAD_DOWN DOWN_AND_UP
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]java.net.SocketException: Broken pipe
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at java.net.SocketOutputStream.socketWrite0(Native Method)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:202)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:272)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:276)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:122)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:212)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at java.io.BufferedWriter.flush(BufferedWriter.java:236)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at com.android.monkeyrunner.MonkeyManager.sendMonkeyEventAndGetResponse
(MonkeyManager.java:167)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at com.android.monkeyrunner.MonkeyManager.sendMonkeyEvent
(MonkeyManager.java:214)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at com.android.monkeyrunner.MonkeyManager.press(MonkeyManager.java:116)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at com.android.monkeyrunner.adb.AdbMonkeyDevice.press
(AdbMonkeyDevice.java:291)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at com.android.monkeyrunner.MonkeyDevice.press(MonkeyDevice.java:202)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at java.lang.reflect.Method.invoke(Method.java:597)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:175)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at org.python.core.PyObject.__call__(PyObject.java:355)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at org.python.core.PyMethod.__call__(PyMethod.java:215)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:221)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at org.python.core.PyMethod.__call__(PyMethod.java:206)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at org.python.core.PyObject.__call__(PyObject.java:414)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at org.python.core.PyObject.__call__(PyObject.java:418)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at org.python.pycode._pyx8.f$0(<stdin>:1)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at org.python.pycode._pyx8.call_function(<stdin>)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at org.python.core.PyTableCode.call(PyTableCode.java:165)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at org.python.core.PyCode.call(PyCode.java:18)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at org.python.core.Py.runCode(Py.java:1197)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at org.python.core.Py.exec(Py.java:1241)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:147)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at org.python.util.InteractiveInterpreter.runcode
(InteractiveInterpreter.java:89)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at org.python.util.InteractiveInterpreter.runsource
(InteractiveInterpreter.java:70)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at org.python.util.InteractiveInterpreter.runsource
(InteractiveInterpreter.java:46)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at org.python.util.InteractiveConsole.push(InteractiveConsole.java:110)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at org.python.util.InteractiveConsole.interact(InteractiveConsole.java:90)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at org.python.util.InteractiveConsole.interact(InteractiveConsole.java:60)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at com.android.monkeyrunner.ScriptRunner.console(ScriptRunner.java:193)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at com.android.monkeyrunner.MonkeyRunnerStarter.run
(MonkeyRunnerStarter.java:89)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] at com.android.monkeyrunner.MonkeyRunnerStarter.main
(MonkeyRunnerStarter.java:203) --------------------编程问答-------------------- 我也是相同的问题,奇怪的是模拟器上面显示正常,知道解决办法了吗? --------------------编程问答-------------------- 我也有相同的问题。 --------------------编程问答-------------------- 我的也是一样问题,求高手解决 --------------------编程问答-------------------- 同样的问题,求问方法 --------------------编程问答-------------------- 同样的问题,求问方法
补充:移动开发 , Android