nir
nir

Reputation: 159

android - running monkeyrunner over wifi on a real device

I have a build server and I would like to run a monkeyrunner script on many devices simultaneously once the build is ready.

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

so I connected to a device and successfuly ran "adb monkey", "adb shell ls",...

when i run the monkeyrunner i get errors - it can't connect.

here is another guy that looks for a solution

is it a bug in the monkeyrunner? is there a workaround?

is there other tool I can use?

Upvotes: 1

Views: 3363

Answers (1)

KevinChung
KevinChung

Reputation: 51

The problem due to the command for create port forwarding is not for TCP connected device. If you looking in "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);

It is work fine for me by modify adb command to

byte[] request = formAdbRequest(String.format(
                   "host:forward:tcp:%1$d;tcp:%2$d",localPort, remotePort));

Than you need to rebuild ddmlib.jar

Upvotes: 3

Related Questions