Hi,all:

      How to implement my own monkeyrunner plugin?

      I want to use the plugin's functions in my python scripts.The reason 
for this is: i want to communicate with device in my python script for 
other functions except the functions which are supplied by monkeyrunner.

      My code as follow:

public class ScreenSwitchTime extends PyObject implements ClassDictInit {
/**
 * 
 */
private static final long serialVersionUID = -6663473932066100848L;

public static void classDictInit(PyObject dict) {
JythonUtils.convertDocAnnotationsForClass(ScreenSwitchTime.class, dict);
}

@MonkeyRunnerExported(doc = "for testing monkeyrunner plugin",returns = "a 
string")
public String test(PyObject[] args, String[] kws) {
ArgParser ap = JythonUtils.createArgParser(args, kws);
Preconditions.checkNotNull(ap);

return ap.getString(0)+ ",This is only for testing!";
}
}

but when i run monkeyrunner with the command  of " monkeyrunner -plugin 
***\myplugin.jar d:\mytest.py" ,i get the exception:

130308 15:44:12.705:S [main] [com.android.monkeyrunner.MonkeyRunnerStarter] 
Unable to coerce object into correct type: cmcc.stability.ScreenSwitchTime
130308 15:44:15.355:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] 
Plugin Main returned error for: d:\MyPlugin.jar

Thanks!

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to