huashan8 发表于 2015-10-1 09:28:24

monkeyrunner through wifi

  最近的测试工作需要连接N台pad,usb hub已经满了。于是乎考虑用wifi建立连接。adb through network只要制定参数就OK了。monkeyrunner在底层也是利用的adb来实现测试工作的。修改ddmlib,重新编译搞定。以下摘自http://stackoverflow.com/questions/5859559/android-running-monkeyrunner-over-wifi-on-a-real-device
  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"

publicstaticvoid createForward(InetSocketAddress adbSockAddr,Device device,int localPort,int remotePort)throwsTimeoutException,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));
页: [1]
查看完整版本: monkeyrunner through wifi