Error starting command: monkey --port 12345 卡死的问题
来源:互联网 发布:nginx 1.10 1.12 编辑:程序博客网 时间:2024/06/05 00:01
七月 02, 2014 2:18:08 下午 com.sprd.tool.traverse.TraverseTool$MyClock run警告: Time up!Clock is closing!七月 02, 2014 2:18:23 下午 com.sprd.tool.traverse.Device getWindowId警告: getWindowId()--runtimeException七月 02, 2014 2:18:23 下午 com.android.chimpchat.ChimpManager sendMonkeyEventAndGetResponse信息: Monkey Command: quit.七月 02, 2014 2:18:23 下午 com.sprd.tool.traverse.UIOrderTraverseTool traverseWindow信息: change type NEW七月 02, 2014 2:18:25 下午 com.android.chimpchat.ChimpManager sendMonkeyEventAndGetResponse信息: Monkey Command: wake.七月 02, 2014 2:18:25 下午 com.sprd.tool.traverse.Device startChimpDevice警告: start monkeyrunner七月 02, 2014 2:18:25 下午 com.android.chimpchat.ChimpManager sendMonkeyEventAndGetResponse信息: Monkey Command: quit.七月 02, 2014 2:18:28 下午 com.android.chimpchat.ChimpManager sendMonkeyEventAndGetResponse信息: Monkey Command: quit.七月 02, 2014 2:18:28 下午 com.android.chimpchat.ChimpManager sendMonkeyEventAndGetResponse信息: Monkey Command: quit.七月 02, 2014 2:18:28 下午 com.android.chimpchat.ChimpManager sendMonkeyEventAndGetResponse信息: Monkey Command: quit.七月 02, 2014 2:18:28 下午 com.android.chimpchat.ChimpManager sendMonkeyEventAndGetResponse信息: Monkey Command: quit.七月 02, 2014 2:18:28 下午 com.android.chimpchat.ChimpManager sendMonkeyEventAndGetResponse信息: Monkey Command: quit.七月 02, 2014 2:18:30 下午 com.android.chimpchat.ChimpManager sendMonkeyEventAndGetResponse信息: Monkey Command: wake.七月 02, 2014 2:18:40 下午 com.android.chimpchat.adb.AdbChimpDevice$1 run信息: Error starting command: monkey --port 12345com.android.ddmlib.ShellCommandUnresponsiveException at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:430) at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:347) at com.android.ddmlib.Device.executeShellCommand(Device.java:435) at com.android.chimpchat.adb.AdbChimpDevice$1.run(AdbChimpDevice.java:104) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
hierarchyviewer输出:
02:17:57 E/hierarchyviewer: Timeout setting up port forwarding for 1644220901096102:18:09 E/hierarchyviewer: Timeout checking status of view server on device 1644220901096102:18:21 E/hierarchyviewer: Timeout starting view server on device 1644220901096102:18:23 E/hierarchyviewer: Unable to debug device 16442209010961
public static boolean startViewServer(IDevice device, int port) { boolean[] result = new boolean[1]; try { if (device.isOnline()) device.executeShellCommand(buildStartServerShellCommand(port), new BooleanResultReader(result)); } catch (TimeoutException e) { Log.e("hierarchyviewer", "Timeout starting view server on device " + device); } catch (IOException e) { Log.e("hierarchyviewer", "Unable to start view server on device " + device); } catch (AdbCommandRejectedException e) { Log.e("hierarchyviewer", "Adb rejected command to start view server on device " + device); } catch (ShellCommandUnresponsiveException e) { Log.e("hierarchyviewer", "Unable to execute command to start view server on device " + device); } return result[0]; }
public static boolean isViewServerRunning(IDevice device) { boolean[] result = new boolean[1]; try { if (device.isOnline()) { device.executeShellCommand(buildIsServerRunningShellCommand(), new BooleanResultReader(result)); if (result[0] == 0) { ViewServerInfo serverInfo = loadViewServerInfo(device); if ((serverInfo != null) && (serverInfo.protocolVersion > 2)) result[0] = true; } } } catch (TimeoutException e) { Log.e("hierarchyviewer", "Timeout checking status of view server on device " + device); } catch (IOException e) { Log.e("hierarchyviewer", "Unable to check status of view server on device " + device); } catch (AdbCommandRejectedException e) { Log.e("hierarchyviewer", "Adb rejected command to check status of view server on device " + device); } catch (ShellCommandUnresponsiveException e) { Log.e("hierarchyviewer", "Unable to execute command to check status of view server on device " + device); } return result[0]; }
public static boolean startViewServer(IDevice device) { return startViewServer(device, 4939); } public static boolean startViewServer(IDevice device, int port) { boolean[] result = new boolean[1]; try { if (device.isOnline()) device.executeShellCommand(buildStartServerShellCommand(port), new BooleanResultReader(result)); } catch (TimeoutException e) { Log.e("hierarchyviewer", "Timeout starting view server on device " + device); } catch (IOException e) { Log.e("hierarchyviewer", "Unable to start view server on device " + device); } catch (AdbCommandRejectedException e) { Log.e("hierarchyviewer", "Adb rejected command to start view server on device " + device); } catch (ShellCommandUnresponsiveException e) { Log.e("hierarchyviewer", "Unable to execute command to start view server on device " + device); } return result[0]; }
private void setupViewServer() { DeviceBridge.setupDeviceForward(this.mDevice); if ((!DeviceBridge.isViewServerRunning(this.mDevice)) && (!DeviceBridge.startViewServer(this.mDevice))) { try { Thread.sleep(2000L); } catch (InterruptedException e) { } if (!DeviceBridge.startViewServer(this.mDevice)) { Log.e("hierarchyviewer", "Unable to debug device " + this.mDevice); throw new RuntimeException("Could not connect to the view server"); } return; }
程序会卡死。
C:\Documents and Settings\hui.qian>netstat -a -n | find /I "4939" TCP 127.0.0.1:4939 0.0.0.0:0 LISTENINGC:\Documents and Settings\hui.qian>netstat -aon |findstr "4939" TCP 127.0.0.1:4939 0.0.0.0:0 LISTENING 44588C:\Documents and Settings\hui.qian>tasklist|findstr "44588"adb.exe 44588 Console 0 2,260 K
发现4939的端口被adb.exe占用。
再次启动adb会报:
02:56:02 E/adb: ADB server didn't ACK02:56:02 E/adb: * failed to start daemon *
解决adb报错的问题用
netstat -aon|findstr "5037"
然后根据结果中的最后一列里的PID来获取哪个进程占用
tasklist|findstr "21900"
taskkill /f /t /im adb.exe
C:\Documents and Settings\hui.qian>adb devicesList of devices attached16442209010961 device
adb的问题解决。
==================================================================================================================================
对于
Error starting command: monkey --port 12345的错误分析指出这个错误就是因为adb的12345不能被映射造成的,具体原因还没找到。现在只是粗暴的重启adb。
解决办法:
用Future的方式限制启动Monkeyrunner的时间,如果时间超出还没有启动,则重启adb。(以下代码仅供参考)
public void startChimpDevice() {ExecutorService exec = Executors.newFixedThreadPool(1);Callable<String> call = new Callable<String>() {public String call() throws Exception {// 开始执行耗时操作startChimpDevice1();return "Done";}};try {Future<String> future = exec.submit(call);String obj = future.get(60 * 1000 * 10, TimeUnit.MILLISECONDS);LOG.log(Level.WARNING, "启动成功" + obj);} catch (Exception e) {System.out.println("遍历时出现卡顿,可能是端口映射出错,重新连接");AndroidDebugBridge.getBridge().restart();//CMDUtils.runCMD1("adb kill-server", "");//CMDUtils.runCMD1("adb start-server", "");LOG.log(Level.WARNING, "启动monkey的设备失败");e.printStackTrace();}// 关闭线程池exec.shutdown();}
0 0
- Error starting command: monkey --port 12345 卡死的问题
- Starting udev卡死的问题
- Error starting static Resources 问题
- Tomcat项目的部署问题之Error starting static Resources
- windows7上安装matlab出现的error starting desktop问题
- port command successful consider using pasv! 问题
- an error occurred starting mathtype's command for word
- 500 Illegal PORT command的问题(FTP主被动模式)
- FTP: 500 Illegal PORT command的问题(主被动模式)
- TOMCAT问题;严重: Error starting static Resources
- TOMCAT问题;严重: Error starting static Resources
- myeclipse卡死的问题
- matlab7.0 runtime error问题 或者Error Starting Desktop问题
- 关于ST-Link的internal command error问题的解决方法
- 关于Matlab R2007a出现 Error Starting desktop的问题,及解决。
- Tomcat启动时出现“严重: Error starting static Resources”问题的解决
- Tomcat启动时出现“严重: Error starting static Resources”问题的解决
- 关于 MyEclipse 突然出现 Error starting Tomcat 6.x server 问题的解决
- provider:命名管道提供程序,error:40 - 无法打开到SQL Server的连接 (Microsoft SQL Server, 错误:53)
- setStyleSheet来设定窗口部件的样式
- 一级缓存和二级缓存
- 用俩个栈实现二叉树的非递归后序遍历
- 微软这是把Android当QNX用啊
- Error starting command: monkey --port 12345 卡死的问题
- 华为初级——iNOC产品部:杨辉三角形的变形
- JAVA学习篇--静态代理VS动态代理
- 对SVM的理解
- UVA 12718 Dromicpalin Substrings(寻找字符串连续子串的回文)
- Linux中source命令的用法
- 后缀自动机的直观理解
- java把class类写入excel和读取出来的通用方法
- ERROR 1045 (28000): Access denied for user root@localhost (using password: YES)