MonkeyRunner_用eclipse调试monkeyrunner的脚本

转发http://www.google.com.hk/url?sa=t&source=web&cd=1&ved=0CBkQFjAA&url=http%3A%2F%2Fdtmilano.blogspot.com%2F2011%2F03%2Fusing-android-monkeyrunner-from-eclipse.html&rct=j&q=monkeyrunner%20eclipse&ei=ZfduTuH9AuWViAfFocnJCQ&usg=AFQjCNG6-Z1c7MD-QfmSZN9YmTN6QLM3_A&cad=rjt

Using Android monkeyrunner from Eclipse

You may want to edit scripts and run them from Eclipse.
To be able to do this you must first install PyDev from Eclipse Marketplace.

Latest versions of PyDev don't work with monkeyrunner because it is not detected as a valid interpreter. I'm sure this will be finxed in the future. In the meantime you should stick to PyDev 1.6.5.


Then you have to define a new python interpreter


but before you can do it you need to do some changes to the Android installation. We need to replace the monkeyrunner interpreter because Eclipse invokes it using the -u command line option,  unbuffer stdin, stdout and stderr, which is not supported by monkeyrunner. To solve it we should rename the original interpreter to monkeyrunner-original and then use this script as a replacement for  monkeyrunner.
# /bin/bash
if [ "$1" = '-u' ]
then
shift
fi

exec /home/zhouzhibin/android-sdk-2.3.4/tools/monkeyrunner-original "$@"

if you are using Microsoft Windows, you should use something like this (script contributed by tagmaster)

REM
@echo off 
if("%1")==("-u") shift 
"C:\Program Files\Android\android-sdk\tools"/monkeyrunner-original %1 %2 %3 %4 %5 %6 %7 %8 
Once the new interpreter is defined and assigned to aPyDev project you will be able to edit and runmonkeyrunner scripts from Eclipse



Don't forget to set the previously defined interpreter to the project properties.


Update: July 2011
This patch was added to monkeyrunner to ignore the-u option sent by PyDev:
http://android.git.kernel.org/?p=platform/sdk.git;a=commitdiff;h=f07d8c2026606633f1de7e1ab9d985c74ad8b340
However, the usage string does not include the -u option yet. BTW, credit would be nice.
So, the wrapper is not needed any more.
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值