我怎样才能让使用Monkeyrunner API的Java应用程序? [英] How can I make a Java app using the Monkeyrunner API?

查看:140
本文介绍了我怎样才能让使用Monkeyrunner API的Java应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Android SDK中有用于将命令发送到名为Monkeyrunner手机的API。这似乎是一个Python API。反正我有可以在Java应用程序中使用它?

The Android SDK has an API for sending commands to the phone called Monkeyrunner. It appears to be a Python API. Is there anyway I can use it in a Java application?

推荐答案

嗯,我一直在努力做到这一点,这里是我发现(感谢谷歌和成员的一些帮助在互联网上)

Well I have been trying to do this, here is what I found (Thanks to google and some help from members on the internet)

下面是一个使用monkeyrunner打印设备的名称一点Java程序

Here is a little Java program that uses monkeyrunner to print the name of the device

import com.android.monkeyrunner.MonkeyDevice;
import com.android.monkeyrunner.adb.AdbBackend;

public class Monk {

 public static void main(String[] args) {
    // TODO code application logic here
    Monk monk=new Monk();
    monk.demo();
 }
 public void demo()
 {
    AdbBackend ab = new AdbBackend();
    MonkeyDevice device = ab.waitForConnection();
    //Print Device Name       
    System.out.println(device.getProperty("build.model"));
    device.dispose();
 }

}

有关上述code太多的工作,我需要包括以下几个罐子monkeyrunner,ddmlib,Jython中,guavalib,sdklib。

For the above code too work, I needed to include the following jars monkeyrunner, ddmlib, jython, guavalib, sdklib.

这篇关于我怎样才能让使用Monkeyrunner API的Java应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆