android - 在真实设备上通过wifi运行monkeyrunner

时间:2011-05-02 16:19:56

标签: android adb monkeyrunner monkey

我有一个构建服务器,我想在构建完成后同时在许多设备上运行monkeyrunner脚本。

I found here a way to connect to the devices over tcp

所以我连接到一个设备并成功运行“adb monkey”,“adb shell ls”,...

当我运行monkeyrunner时,我得到错误 - 它无法连接。

here is another guy that looks for a solution

这是monkeyrunner中的一个错误吗?有解决方法吗?

我还可以使用其他工具吗?

1 个答案:

答案 0 :(得分:3)

由于创建端口转发命令导致的问题不适用于TCP连接设备。如果你查看“sdk \ ddms \ libs \ ddmlib \ src \ com \ android \ ddmlib \ AdbHelper.java”

    public static void createForward(InetSocketAddress adbSockAddr, Device device, int localPort,
        int remotePort) throws TimeoutException, AdbCommandRejectedException, IOException {

    SocketChannel adbChan = null;
    try {
        adbChan = SocketChannel.open(adbSockAddr);
        adbChan.configureBlocking(false);

        byte[] request = formAdbRequest(String.format(
                "host-serial:%1$s:forward:tcp:%2$d;tcp:%3$d", //$NON-NLS-1$
                device.getSerialNumber(), localPort, remotePort));

        write(adbChan, request);

通过将adb命令修改为

,这对我来说很好
byte[] request = formAdbRequest(String.format(
                   "host:forward:tcp:%1$d;tcp:%2$d",localPort, remotePort));

比你需要重建ddmlib.jar