2

I have over a hundred Espresso tests. Once in a while, when I launch them using ./gradlew clean cAT the tests complete on the connected device, in my case Genymotion emulator, but when they're done, the gradle task is stuck in the terminal at Building 96% > : <appname>:connectedAndroidTest . I can close the task with CTRL+C, but as it doesn't complete normally, no html output is produced.

EDIT:

10 minutes after the tests had concluded this is produced in the terminal (-d flag):

`
22:07:44.542 [DEBUG] [org.gradle.api.Task] DeviceConnector 'Google Nexus 5 - 5.1.0 - API 22 - 1080x1920 - 5.1': uninstalling <package>.test
    22:07:44.551 [ERROR] [org.gradle.api.Task] Unable to uninstall <package>.test
    com.android.ddmlib.InstallException: device '192.168.59.101:5555' not found
        at com.android.ddmlib.Device.uninstallPackage(Device.java:1015)
        at com.android.builder.testing.ConnectedDevice.uninstallPackage(ConnectedDevice.java:136)
        at com.android.builder.internal.testing.SimpleTestCallable.uninstall(SimpleTestCallable.java:260)
        at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:242)
        at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:48)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: com.android.ddmlib.AdbCommandRejectedException: device '192.168.59.101:5555' not found
        at com.android.ddmlib.AdbHelper.setDevice(AdbHelper.java:862)
        at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:451)
        at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:382)
        at com.android.ddmlib.Device.executeShellCommand(Device.java:615)
        at com.android.ddmlib.Device.uninstallPackage(Device.java:1009)
        ... 10 more
    22:07:44.554 [ERROR] [org.gradle.api.Task] null
    com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: device '192.168.59.101:5555' not found
        at com.android.builder.testing.ConnectedDevice.uninstallPackage(ConnectedDevice.java:139)
        at com.android.builder.internal.testing.SimpleTestCallable.uninstall(SimpleTestCallable.java:260)
        at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:242)
        at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:48)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: com.android.ddmlib.InstallException: device '192.168.59.101:5555' not found
        at com.android.ddmlib.Device.uninstallPackage(Device.java:1015)
        at com.android.builder.testing.ConnectedDevice.uninstallPackage(ConnectedDevice.java:136)
        ... 9 more
    Caused by: com.android.ddmlib.AdbCommandRejectedException: device '192.168.59.101:5555' not found
        at com.android.ddmlib.AdbHelper.setDevice(AdbHelper.java:862)
        at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:451)
        at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:382)
        at com.android.ddmlib.Device.executeShellCommand(Device.java:615)
        at com.android.ddmlib.Device.uninstallPackage(Device.java:1009)
        ... 10 more
    22:07:44.658 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':<appname>:connectedAndroidTest'
    22:07:44.658 [LIFECYCLE] [class org.gradle.TaskExecutionLogger] :<appname>:connectedAndroidTest FAILED
`

EDIT: It looks like it hangs on trying to uninstall the app in test.

TomaszRykala
  • 927
  • 6
  • 16
  • 33
  • 1
    please you use -d option to see where it hangs and post it here – nenick May 24 '16 at 17:46
  • @nenick, edited the question with the info – TomaszRykala May 24 '16 at 21:20
  • Did you try different emulators? google emulator, real device ... Perhaps this is a Genymotion issue. – nenick May 25 '16 at 05:30
  • It seems the adb connection is lost during the test. Can you try to launch 'adb devices' command when it's stuck to confirm the problem? – eyal-lezmy May 25 '16 at 08:46
  • @eyal-lezmy `adb devices` reports `List of devices attached 192.168.59.101:5555 device` (device is live and not offline) – TomaszRykala May 25 '16 at 22:44
  • @nenick same issue when running the test on a connected physical device (nexus 9) – TomaszRykala May 26 '16 at 09:01
  • @nenick same issue when running the test on Google's Android Studio 2.0 emulator – TomaszRykala May 26 '16 at 09:25
  • You said hundred of tests ... so i guess it had work without issues someday? Maybe there was a change like update sdk tools or update android gradle plugin. Do you get this error also when you only run few tests? Do you see any errors in the logcat? When using `adb devices` after this error occured do you get something like `* daemon not running. starting it now on port 5037 *`? – nenick May 26 '16 at 10:39

0 Answers0