Android CTS is showing ShellCommandUnresponsiveException on emulator

谁说我不能喝 提交于 2020-01-13 04:31:20

问题


I am running Android CTS Android Test Plan on an emulator running on Android 2.2.

But most of the test cases are showing timeout and the error shows com.android.ddmlib.ShellCommandUnresponsiveException.

Is there any way to solve this issue ?


回答1:


Set shell command time out to 5 minutes (instead of 5 seconds:-))

diff --git a/tools/host/src/com/android/cts/TestDevice.java b/tools/host/src/com/android/cts/TestDevice.java
index 65ff969..b8578bc 100644
--- a/tools/host/src/com/android/cts/TestDevice.java
+++ b/tools/host/src/com/android/cts/TestDevice.java
@@ -18,6 +18,7 @@ package com.android.cts;

 import com.android.ddmlib.Client;
 import com.android.ddmlib.ClientData;
+import com.android.ddmlib.DdmPreferences;
 import com.android.ddmlib.IDevice;
 import com.android.ddmlib.IShellOutputReceiver;
 import com.android.ddmlib.MultiLineReceiver;
@@ -143,6 +144,7 @@ public class TestDevice implements DeviceObserver {
         mDeviceInfo = new DeviceParameterCollector();
         mPackageActionTimer = new PackageActionTimer();
         mObjectSync = new ObjectSync();
+        DdmPreferences.setTimeOut(300000);
     }



回答2:


A bit more notes for newbies like me:

  1. download android source
  2. apply the patch, and build with command: make cts
  3. copy the newly built file cts.jar to replace the stock one.

This fix CTS timeout problem because some adb commands needs more than 20 seconds to return on my MotoA953 device (one of these is am instrument -w -e bundle true android.tests.devicesetup/android.tests.getinfo.DeviceInfoInstrument).



来源:https://stackoverflow.com/questions/4264057/android-cts-is-showing-shellcommandunresponsiveexception-on-emulator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!