Com.android.ddmlib.InstallException when running tests

android

#1

I am getting an InstallException when running tests.

Building 96% > :app:connectedDebugAndroidTestUnable to install /home/ubuntu/popular-movies-app/app/build/outputs/apk/app-debug.apk
Building 96% > :app:connectedDebugAndroidTest
Building 96% > :app:connectedDebugAndroidTestcom.android.ddmlib.InstallException
Building 96% > :app:connectedDebugAndroidTest at com.android.ddmlib.SplitApkInstaller.install(SplitApkInstaller.java:96)
Building 96% > :app:connectedDebugAndroidTest at com.android.ddmlib.Device.installPackages(Device.java:901)
Building 96% > :app:connectedDebugAndroidTest at com.android.builder.testing.ConnectedDevice.installPackages(ConnectedDevice.java:108)
Building 96% > :app:connectedDebugAndroidTest at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:121)
Building 96% > :app:connectedDebugAndroidTest at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:48)
Building 96% > :app:connectedDebugAndroidTest at java.util.concurrent.FutureTask.run(FutureTask.java:262)
Building 96% > :app:connectedDebugAndroidTest at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
Building 96% > :app:connectedDebugAndroidTest at java.util.concurrent.FutureTask.run(FutureTask.java:262)
Building 96% > :app:connectedDebugAndroidTest at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
Building 96% > :app:connectedDebugAndroidTest at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
Building 96% > :app:connectedDebugAndroidTest at java.lang.Thread.run(Thread.java:745)
Building 96% > :app:connectedDebugAndroidTestCaused by: com.android.ddmlib.ShellCommandUnresponsiveException
Building 96% > :app:connectedDebugAndroidTest at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:504)
Building 96% > :app:connectedDebugAndroidTest at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:382)
Building 96% > :app:connectedDebugAndroidTest at com.android.ddmlib.Device.executeShellCommand(Device.java:615)
Building 96% > :app:connectedDebugAndroidTest at com.android.ddmlib.SplitApkInstaller.install(SplitApkInstaller.java:82)
Building 96% > :app:connectedDebugAndroidTest … 10 more
Building 96% > :app:connectedDebugAndroidTest
Building 96% > :app:connectedDebugAndroidTestcom.android.builder.testing.ConnectedDevice > runTests[circleci-android22(AVD) - 5.1] FAILED
Building 96% > :app:connectedDebugAndroidTest
Building 96% > :app:connectedDebugAndroidTest com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException
Building 96% > :app:connectedDebugAndroidTest at com.android.builder.testing.ConnectedDevice.installPackages(ConnectedDevice.java:118)
Building 96% > :app:connectedDebugAndroidTest
Building 96% > :app:connectedDebugAndroidTestnull
Building 96% > :app:connectedDebugAndroidTest
Building 96% > :app:connectedDebugAndroidTestcom.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException
Building 96% > :app:connectedDebugAndroidTest at com.android.builder.testing.ConnectedDevice.installPackages(ConnectedDevice.java:118)
Building 96% > :app:connectedDebugAndroidTest at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:121)
Building 96% > :app:connectedDebugAndroidTest at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:48)
Building 96% > :app:connectedDebugAndroidTest at java.util.concurrent.FutureTask.run(FutureTask.java:262)
Building 96% > :app:connectedDebugAndroidTest at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
Building 96% > :app:connectedDebugAndroidTest at java.util.concurrent.FutureTask.run(FutureTask.java:262)
Building 96% > :app:connectedDebugAndroidTest at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
Building 96% > :app:connectedDebugAndroidTest at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
Building 96% > :app:connectedDebugAndroidTest at java.lang.Thread.run(Thread.java:745)
Building 96% > :app:connectedDebugAndroidTestCaused by: com.android.ddmlib.InstallException
Building 96% > :app:connectedDebugAndroidTest at com.android.ddmlib.SplitApkInstaller.install(SplitApkInstaller.java:96)
Building 96% > :app:connectedDebugAndroidTest at com.android.ddmlib.Device.installPackages(Device.java:901)
Building 96% > :app:connectedDebugAndroidTest at com.android.builder.testing.ConnectedDevice.installPackages(ConnectedDevice.java:108)
Building 96% > :app:connectedDebugAndroidTest … 8 more
Building 96% > :app:connectedDebugAndroidTestCaused by: com.android.ddmlib.ShellCommandUnresponsiveException
Building 96% > :app:connectedDebugAndroidTest at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:504)
Building 96% > :app:connectedDebugAndroidTest at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:382)
Building 96% > :app:connectedDebugAndroidTest at com.android.ddmlib.Device.executeShellCommand(Device.java:615)
Building 96% > :app:connectedDebugAndroidTest at com.android.ddmlib.SplitApkInstaller.install(SplitApkInstaller.java:82)
Building 96% > :app:connectedDebugAndroidTest … 10 more
Building 96% > :app:connectedDebugAndroidTest:app:connectedDebugAndroidTest

The problem is similar to the following stackoverflow question
https://stackoverflow.com/q/32276397/5758378

I tried the suggested solution

I tried adding the timeout in various ways:
In my gradble file, by means of an environment variable and as a parameter to the ./gradlew connectedAndroidTests command, but I can’t solve it.

Here’s my full circle.yml file:

general:
artifacts:
    - /home/ubuntu/popular-movies-app/app/build/outputs/apk/

machine:
environment:
    ADB_INSTALL_TIMEOUT: 8
    ANDROID_HOME: /usr/local/android-sdk-linux

dependencies:
  cache_directories:
- /home/ubuntu/.android
- /home/ubuntu/android
  override:
    - echo y | android update sdk --no-ui --all --filter "tools,platform-tools,android-23"
    - echo y | android update sdk --no-ui --all --filter "build-tools-23.0.2"
 test:
   override:
     - emulator -avd circleci-android22 -no-audio -no-window:
        background: true
        parallel: true
   - circle-android wait-for-boot
   - (./gradlew connectedAndroidTest):
       timeout: 1200
   - cp -r app/build/outputs $CIRCLE_ARTIFACTS
   - cp -r app/outputs/androidTest-results/* $CIRCLE_TEST_REPORTS

DaemonConnectionException thrown when running tests
#2

Note that with the emulator image circleci-android21 this doesn’t occur, tests execute successfully…


#3