1

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?

Community
  • 1
  • 1
nir
  • 161
  • 2
  • 7
  • Based on my suspicions about the other guy's problem, can you run 'adb devices' after monkeyrunner fails and post the output? – Chris Stratton May 02 '11 at 19:23

1 Answers1

3

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

KevinChung
  • 51
  • 3