2012-11-29 50 views
0

的代碼非常簡單Monkeyrunner錯誤一些真正的設備

from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice, MonkeyImage 
device = MonkeyRunner.waitForConnection() 
device.touch(84, 712, "DOWN_AND_UP") 

這是確定對模擬器和我的SE的Xperia雷運行,

但是當我另一個設備,這是不賣上運行市場。

彈出錯誤消息。

這是確定運行一些命令,例如,採取「快照」

但對於「觸摸」,「按」,總是失敗。

是它的一些monkeyruuner錯誤,對於某些設備,它只是沒有奏效

或問題是在設備上,也許修改的設備的源代碼有一些問題。

我在互聯網上搜索,並不能找到這個解決方案,

,我需要決定使用monkeyruuner設備或不上,

所以,我需要一些幫助。

對不起我的英語:)

錯誤日誌

121129 10:56:42.227:S [main] [com.android.chimpchat.adb.AdbChimpDevice] Error se 
nding touch event: 84 712 DOWN_AND_UP 
121129 10:56:42.227:S [main] [com.android.chimpchat.adb.AdbChimpDevice]java.net. 
SocketException: Software caused connection abort: socket write error 
121129 10:56:42.227:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at java. 
net.SocketOutputStream.socketWrite0(Native Method) 
121129 10:56:42.227:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at java. 
net.SocketOutputStream.socketWrite(SocketOutputStream.java:92) 
121129 10:56:42.227:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at java. 
net.SocketOutputStream.write(SocketOutputStream.java:136) 
121129 10:56:42.227:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at sun.n 
io.cs.StreamEncoder.writeBytes(StreamEncoder.java:202) 
121129 10:56:42.227:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at sun.n 
io.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:272) 
121129 10:56:42.227:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at sun.n 
io.cs.StreamEncoder.implFlush(StreamEncoder.java:276) 
121129 10:56:42.227:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at sun.n 
io.cs.StreamEncoder.flush(StreamEncoder.java:122) 
121129 10:56:42.227:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at java. 
io.OutputStreamWriter.flush(OutputStreamWriter.java:212) 
121129 10:56:42.227:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at java. 
io.BufferedWriter.flush(BufferedWriter.java:236) 
121129 10:56:42.227:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at com.a 
ndroid.chimpchat.ChimpManager.sendMonkeyEventAndGetResponse(ChimpManager.java:18 
6) 
121129 10:56:42.227:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at com.a 
ndroid.chimpchat.ChimpManager.sendMonkeyEvent(ChimpManager.java:234) 
121129 10:56:42.227:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at com.a 
ndroid.chimpchat.ChimpManager.tap(ChimpManager.java:329) 
121129 10:56:42.227:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at com.a 
ndroid.chimpchat.adb.AdbChimpDevice.touch(AdbChimpDevice.java:361) 
121129 10:56:42.227:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at com.a 
ndroid.monkeyrunner.MonkeyDevice.touch(MonkeyDevice.java:136) 
121129 10:56:42.227:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at sun.r 
eflect.NativeMethodAccessorImpl.invoke0(Native Method) 
121129 10:56:42.227:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at sun.r 
eflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
121129 10:56:42.227:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at sun.r 
eflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 

121129 10:56:42.227:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at java. 
lang.reflect.Method.invoke(Method.java:597) 
121129 10:56:42.227:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.p 
ython.core.PyReflectedFunction.__call__(PyReflectedFunction.java:175) 
121129 10:56:42.227:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.p 
ython.core.PyObject.__call__(PyObject.java:355) 
121129 10:56:42.227:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.p 
ython.core.PyMethod.__call__(PyMethod.java:215) 
121129 10:56:42.227:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.p 
ython.core.PyMethod.instancemethod___call__(PyMethod.java:221) 
121129 10:56:42.227:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.p 
ython.core.PyMethod.__call__(PyMethod.java:206) 
121129 10:56:42.227:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.p 
ython.core.PyObject.__call__(PyObject.java:432) 
121129 10:56:42.227:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.p 
ython.core.PyObject.__call__(PyObject.java:436) 
121129 10:56:42.227:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.p 
ython.pycode._pyx0.f$0(d:\1234.py:18) 
121129 10:56:42.227:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.p 
ython.pycode._pyx0.call_function(d:\1234.py) 
121129 10:56:42.227:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.p 
ython.core.PyTableCode.call(PyTableCode.java:165) 
121129 10:56:42.227:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.p 
ython.core.PyCode.call(PyCode.java:18) 
121129 10:56:42.227:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.p 
ython.core.Py.runCode(Py.java:1197) 
121129 10:56:42.227:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.p 
ython.core.__builtin__.execfile_flags(__builtin__.java:538) 
121129 10:56:42.227:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.p 
ython.util.PythonInterpreter.execfile(PythonInterpreter.java:156) 
121129 10:56:42.227:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at com.a 
ndroid.monkeyrunner.ScriptRunner.run(ScriptRunner.java:116) 
121129 10:56:42.227:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at com.a 
ndroid.monkeyrunner.MonkeyRunnerStarter.run(MonkeyRunnerStarter.java:77) 
121129 10:56:42.227:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at com.a 
ndroid.monkeyrunner.MonkeyRunnerStarter.main(MonkeyRunnerStarter.java:189) 
+0

設備和固件是否通過CTS測試? –

+0

嗨dtmilano,是的,設備和固件通過CTS測試 – Jamy

回答

0

問題可能是在獲取連接

device = MonkeyRunner.waitForConnection() 

可惜裝置從未None,所以驗證它可以採用與ViewClient相同的方法,使用此片段

device = MonkeyRunner.waitForConnection() 
try: 
     device.wake() 
except java.lang.NullPointerException, e: 
     print >> sys.stderr, "%s: ERROR: Couldn't connect to %s: %s" % (progname, serialno, e) 
     sys.exit(3) 
+0

嗨, 我運行代碼後, 121206 14:36:20.494:S [main] [com.android.chimpchat.adb.AdbChimpDevice]無法喚醒設備(太困了?) 121206 14:36:20.494:S [main] [com.android.chimpchat.adb.AdbChimpDevice] java.net.SocketException:軟件導致連接中止:套接字寫入錯誤 ... 。 .. 和,除非不打印消息 – Jamy

+0

查找根本原因可能需要調查您的設備和固件。正如你已經提到的,它不會發生在模擬器或索尼Xperia。 –

+0

明白了,謝謝dtmilano〜:) – Jamy