当前位置:编程学习 > JAVA >>

Eclipse中安装Jython插件后,运行monkeyrunner脚本时弹出提示:ImportError:“ No module named android”

脚本为:
# Imports the monkeyrunner modules used by this program
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice, MonkeyImage
 
device = MonkeyRunner.waitForConnection()
 
#am start -a android.intent.action.SENDTO -d sms:1234567890 --es sms_body ohai --ez exit_on_sent true
#device.shell(' am start -a android.intent.action.SENDTO -d sms:1234567890 --es sms_body ohai --ez exit_on_sent true ')
extraDic = {} 
extraDic['sms_body'] = 'Message to be sent'
#extraDic['exit_on_sent'] = True
device.startActivity(action='android.intent.action.SENDTO', uri='smsto:1234567890')
device.press('KEYCODE_ENTER','DOWN_AND_UP')
 
result = device.takeSnapshot()
result.writeToFile('./shot1.png','png')
 
 
请问各位大神怎么解决???

问题补充: 

完整地报错信息为:
Traceback (most recent call last):
  File "test_sms.py", line 2, in <module>
    from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice, MonkeyImage
ImportError: No module named android[/color] --------------------编程问答-------------------- ...字面意思

你可以先通过Windows --> PyDev --> Interpreter - Jython 中 将android模块导进去 --------------------编程问答-------------------- 问题找到原因了,是SDK没有为Windows提供解释器,所以无法执行,用Linux系统就好了 --------------------编程问答-------------------- 请问楼上怎么导入android模块,我现在也遇到了这个问题,pydev中已经装了解释器了,但是还是无法解决。 --------------------编程问答-------------------- 请问下楼主,,在Windows中怎么解决这个问题?我这也提示 no module named。。。 --------------------编程问答-------------------- 我也遇到同样问题,有没有高手帮忙解决下啊,谢谢啦! --------------------编程问答-------------------- 我也是windows 但是我第一次运行的时候是正确的 现在不知道咋地就错了 也是提示 no module named android --------------------编程问答-------------------- 对了,问楼上一个问题,你是肿么去维护脚本的啊,就是如何去调用其他的自动化.py脚本的啊,一个个运行态慢了。 --------------------编程问答-------------------- 在命令行,运行XXX.py文件时候,前面加上 monkeyrunner 就可以了 --------------------编程问答-------------------- 用eclips运行.py不行吗?我一直提示No module named com.android.monkeyrunner
补充:Java ,  Eclipse
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,