lavender_bj1 发表于 2011-10-17 15:09:28

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)
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 Error sending press event: KEYCODE_DPAD_DOWN DOWN_AND_UP
111017 10:35:28.378:S java.net.SocketException: Broken pipe
111017 10:35:28.378:S         at java.net.SocketOutputStream.socketWrite0(Native Method)
111017 10:35:28.378:S         at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
111017 10:35:28.378:S         at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
111017 10:35:28.378:S         at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:202)
111017 10:35:28.378:S         at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:272)
111017 10:35:28.378:S         at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:276)
111017 10:35:28.378:S         at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:122)
111017 10:35:28.378:S         at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:212)
111017 10:35:28.378:S         at java.io.BufferedWriter.flush(BufferedWriter.java:236)
111017 10:35:28.378:S         at com.android.monkeyrunner.MonkeyManager.sendMonkeyEventAndGetResponse

(MonkeyManager.java:167)
111017 10:35:28.378:S         at com.android.monkeyrunner.MonkeyManager.sendMonkeyEvent

(MonkeyManager.java:214)
111017 10:35:28.378:S         at com.android.monkeyrunner.MonkeyManager.press(MonkeyManager.java:116)
111017 10:35:28.378:S         at com.android.monkeyrunner.adb.AdbMonkeyDevice.press

(AdbMonkeyDevice.java:291)
111017 10:35:28.378:S         at com.android.monkeyrunner.MonkeyDevice.press(MonkeyDevice.java:202)
111017 10:35:28.378:S         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
111017 10:35:28.378:S         at sun.reflect.NativeMethodAccessorImpl.invoke

(NativeMethodAccessorImpl.java:39)
111017 10:35:28.378:S         at sun.reflect.DelegatingMethodAccessorImpl.invoke

(DelegatingMethodAccessorImpl.java:25)
111017 10:35:28.378:S         at java.lang.reflect.Method.invoke(Method.java:597)
111017 10:35:28.378:S         at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:175)
111017 10:35:28.378:S         at org.python.core.PyObject.__call__(PyObject.java:355)
111017 10:35:28.378:S         at org.python.core.PyMethod.__call__(PyMethod.java:215)
111017 10:35:28.378:S         at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:221)
111017 10:35:28.378:S         at org.python.core.PyMethod.__call__(PyMethod.java:206)
111017 10:35:28.378:S         at org.python.core.PyObject.__call__(PyObject.java:414)
111017 10:35:28.378:S         at org.python.core.PyObject.__call__(PyObject.java:418)
111017 10:35:28.378:S         at org.python.pycode._pyx8.f$0(<stdin>:1)
111017 10:35:28.378:S         at org.python.pycode._pyx8.call_function(<stdin>)
111017 10:35:28.378:S         at org.python.core.PyTableCode.call(PyTableCode.java:165)
111017 10:35:28.378:S         at org.python.core.PyCode.call(PyCode.java:18)
111017 10:35:28.378:S         at org.python.core.Py.runCode(Py.java:1197)
111017 10:35:28.378:S         at org.python.core.Py.exec(Py.java:1241)
111017 10:35:28.378:S         at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:147)
111017 10:35:28.378:S         at org.python.util.InteractiveInterpreter.runcode

(InteractiveInterpreter.java:89)
111017 10:35:28.378:S         at org.python.util.InteractiveInterpreter.runsource

(InteractiveInterpreter.java:70)
111017 10:35:28.378:S         at org.python.util.InteractiveInterpreter.runsource

(InteractiveInterpreter.java:46)
111017 10:35:28.378:S         at org.python.util.InteractiveConsole.push(InteractiveConsole.java:110)
111017 10:35:28.378:S         at org.python.util.InteractiveConsole.interact(InteractiveConsole.java:90)
111017 10:35:28.378:S         at org.python.util.InteractiveConsole.interact(InteractiveConsole.java:60)
111017 10:35:28.378:S         at com.android.monkeyrunner.ScriptRunner.console(ScriptRunner.java:193)
111017 10:35:28.378:S         at com.android.monkeyrunner.MonkeyRunnerStarter.run

(MonkeyRunnerStarter.java:89)
111017 10:35:28.378:S         at com.android.monkeyrunner.MonkeyRunnerStarter.main

(MonkeyRunnerStarter.java:203)

八宝粥 发表于 2011-10-18 20:53:04

从log看貌似是ADB的问题。可以关闭DDMS等占用ADB的工具再试试。

yyuanxiang 发表于 2011-11-14 19:41:19

跪求 touch x,y坐标的定位方法

monkeytest15 发表于 2011-12-1 20:41:59

回复 3# yyuanxiang


    tools下面android原生带有工具的

yyuanxiang 发表于 2011-12-3 12:43:40

使用eclipse+pydev写一个monkeyrunner的批处理,,输入from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice提示ImportError: No module named com.android.monkeyrunner错误, 请问是什么原因

40750118 发表于 2012-2-9 13:23:19

将type里面的DOWN_AND_UP变为MonkeyDevice.DOWN_AND_UP就可以了

tanzhengping11 发表于 2012-4-28 11:10:35

回复 6# 40750118


修改为将type里面的DOWN_AND_UP变为MonkeyDevice.DOWN_AND_UP还是不行啊,
在真机上不行,在模拟器是没有问题。

phoenixlwp 发表于 2012-6-28 15:04:52

回复 1# lavender_bj1 请问你这个问题解决了吗?:Q 同样的问题求解中……

chy2436447@ 发表于 2013-5-11 15:39:56

同求,等待中.....
页: [1]
查看完整版本: Monkeyrunner下运行press提示Error sending press event