由于connectedAndroidTestDebug TimeoutException,Android构建在Jenkins中失败

时间:2016-02-05 12:50:41

标签: android-testing

当我尝试在真正的Android设备上部署测试时,我当前的Jenkins构建失败了。

我发现有些人在Travis上有类似的问题,但我找不到很多其他人在Jenkins报道它。

正如您在gradle中输出的错误中所看到的,这是由尝试安装测试时触发的TimeoutException引起的:

sudo systemctl restart docker

我尝试调用Gradle Wrapper,这对于在作业配置中指定版本没有任何区别 - 我尝试了Gradle 2.5-rc-1,Gradle 2.3和Gradle 2.2.1,这最后一个适用于两个版本,然后开始返回此相同的超时错误。

我也尝试过设置环境变量:

:library:connectedAndroidTestDebug
11:20:37 E/Device: Error during Sync: timeout.
Unable to install /Users/Shared/Jenkins/Home/jobs/WORKSPACE_PATH/build/outputs/apk/library-debug-androidTest-unaligned.apk
com.android.ddmlib.InstallException
    at com.android.ddmlib.Device.installPackage(Device.java:853)
    at com.android.builder.testing.ConnectedDevice.installPackage(ConnectedDevice.java:91)
    at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:143)
    at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:49)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: com.android.ddmlib.TimeoutException
    at com.android.ddmlib.AdbHelper.read(AdbHelper.java:769)
    at com.android.ddmlib.SyncService.doPushFile(SyncService.java:695)
    at com.android.ddmlib.SyncService.pushFile(SyncService.java:380)
    at com.android.ddmlib.Device.syncPackageToDevice(Device.java:1069)
    at com.android.ddmlib.Device.installPackage(Device.java:844)
    ... 9 more

com.android.builder.testing.ConnectedDevice > runTests[Nexus 4 - 4.4.4] [31mFAILED [0m
    com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException
        at com.android.builder.testing.ConnectedDevice.installPackage(ConnectedDevice.java:95)
null
com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException
    at com.android.builder.testing.ConnectedDevice.installPackage(ConnectedDevice.java:95)
    at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:143)
    at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:49)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: com.android.ddmlib.InstallException
    at com.android.ddmlib.Device.installPackage(Device.java:853)
    at com.android.builder.testing.ConnectedDevice.installPackage(ConnectedDevice.java:91)
    ... 8 more
Caused by: com.android.ddmlib.TimeoutException
    at com.android.ddmlib.AdbHelper.read(AdbHelper.java:769)
    at com.android.ddmlib.SyncService.doPushFile(SyncService.java:695)
    at com.android.ddmlib.SyncService.pushFile(SyncService.java:380)
    at com.android.ddmlib.Device.syncPackageToDevice(Device.java:1069)
    at com.android.ddmlib.Device.installPackage(Device.java:844)
    ... 9 more
:library:connectedAndroidTestDebug FAILED

FAILURE: Build failed with an exception.

在build.gradle中设置com.android.ddmlib.DdmPreferences.setTimeOut参数:

export ADB_INSTALL_TIMEOUT=10

还尝试使用adbOption'timeOutInMs',它既不起作用。

com.android.ddmlib.DdmPreferences.setTimeOut(60000)

看起来这是code.google.com中的一个持续问题 - 以下两个主题似乎与之相关:

任何想法我还能尝试什么?

谢谢!

1 个答案:

答案 0 :(得分:0)

我最后修复了它restarting the adb server并发出了任何其他adb命令,例如请求设备列表。

只需从终端运行以下命令:

adb kill-server
adb devices

我希望它有所帮助!