腳本:爲什麼MonkeyRunner.waitForConnection()在我的環境不工作
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
device = MonkeyRunner.waitForConnection(5,'192.168.6.60:5555')
device.installPackage('Douban_Radio.apk')
之前運行:
~/android-sdk-linux_86/tools$adb connect 192.168.6.60:5555
connected to 192.168.6.60:5555
~/android-sdk-linux_86/tools$adb devices
List of devices attached
192.168.6.60:5555 device
monkeyrunner的輸出:
~/android-sdk-linux_86/tools$./monkeyrunner monkeyrunnerTest.py
110412 18:12:35.017:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] Script terminated due to an exception
110412 18:12:35.017:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions]Traceback (most recent call last):
File "/home/jobsyang/android-sdk-linux_86/tools/monkeyrunnerTest.py", line 6, in <module>
device.installPackage('Douban_Radio.apk')
AttributeError: 'NoneType' object has no attribute 'installPackage'
......
後運行:
~/android-sdk-linux_86/tools$adb devices
adb server is out of date. killing...
* daemon started successfully *
List of devices attached
我只是不知道爲什麼MonkeyRunner.waitForConnection不工作,並殺死的設備亞行連接?請幫助我,非常感謝!
我在本地的env啓動一個AVD,和所連接的設備是:
~/android-sdk-linux_86/tools$adb devices
List of devices attached
emulator-5554 device
192.168.6.60:5555 device
使用ADB命令是正確的:
~/android-sdk-linux_86/tools$adb -s emulator-5554 install Douban_Radio.apk
859 KB/s (287518 bytes in 0.326s)
pkg: /data/local/tmp/Douban_Radio.apk
Success
~/android-sdk-linux_86/tools$adb -s 192.168.6.60:5555 install Douban_Radio.apk
2108 KB/s (287518 bytes in 0.133s)
pkg: /data/local/tmp/Douban_Radio.apk
Success
隨着MonkeyRunner。腳本中的waitForConnection
MonkeyRunner.waitForConnection(5,'emulator-5554')工作,
但MonkeyRunner.waitForConnection(5,'192.168.6.60:5555')仍然不起作用。
PS:192.168.6.60是與adb連接的真實設備的ip。
是真實設備的serialNumber錯誤,但爲什麼命令「adb -s 192.168.6.60:5555安裝Douban_Radio.apk」的作品?
感謝您的幫助,但問題沒有解決。信息已更新,請看看,非常感謝。 – jobsyang 2011-04-13 07:57:00
使用'emulator-5554'或你的設備有什麼序列號的問題是什麼? – 2011-04-13 15:00:02