简体   繁体   English

Android CTS在模拟器上显示ShellCommandUnresponsiveException

[英]Android CTS is showing ShellCommandUnresponsiveException on emulator

I am running Android CTS Android Test Plan on an emulator running on Android 2.2. 我在Android 2.2上运行的模拟器上运行Android CTS Android测试计划。

But most of the test cases are showing timeout and the error shows com.android.ddmlib.ShellCommandUnresponsiveException. 但是大多数测试用例都显示超时,错误显示com.android.ddmlib.ShellCommandUnresponsiveException。

Is there any way to solve this issue ? 有什么方法可以解决这个问题吗?

Set shell command time out to 5 minutes (instead of 5 seconds:-)) 将shell命令时间设置为5分钟(而不是5秒:-))

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);
     }

A bit more notes for newbies like me: 像我这样的新手有点注意事项:

  1. download android source 下载android源码
  2. apply the patch, and build with command: make cts 应用补丁,并使用命令构建: make cts
  3. copy the newly built file cts.jar to replace the stock one. 复制新构建的文件cts.jar以替换库存文件。

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 ). 这修复了CTS超时问题,因为一些adb命令需要超过20秒才能在我的MotoA953设备上返回(其中一个am instrument -w -e bundle true android.tests.devicesetup/android.tests.getinfo.DeviceInfoInstrument )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM