Home > Net >  How can I fix: Execution failed for task ':app:connectedDebugAndroidTest'?
How can I fix: Execution failed for task ':app:connectedDebugAndroidTest'?

Time:01-20

I have been running tests on an emulator for a while successfully for the App I am currently working and all of a sudden they are not running anymore. I have tried with 2 different emulators, I have not tried on a real device. I have also tried to uninstall the app from the emulator.

This happens for all instrument tests on the current app.

Here is the stacktrace from when trying to run the the test:

> Task :app:connectedDebugAndroidTest
Device provider <com.android.tools.utp.plugins.deviceprovider.ddmlib.DdmlibAndroidDeviceProvider> failed trying to provide device controller.
Android device (emulator-5554) is not found.
com.google.testing.platform.core.device.DeviceProviderException: ErrorName: UNDETERMINED
NameSpace: com.google.testing.platform
ErrorCode: 3999
Message: Android device (emulator-5554) is not found.
    at com.android.tools.utp.plugins.deviceprovider.ddmlib.DdmlibAndroidDeviceProvider.provideDevice(DdmlibAndroidDeviceProvider.kt:116)
    at com.google.testing.platform.executor.DeviceProviderProxy$provideDevice$2.invoke(DeviceProviderProxy.kt:118)
    at com.google.testing.platform.executor.DeviceProviderProxy$provideDevice$2.invoke(DeviceProviderProxy.kt:117)
    at com.google.testing.platform.core.telemetry.common.noop.NoopDiagnosticsScope.recordEvent(NoopDiagnosticsScope.kt:35)
    at com.google.testing.platform.core.telemetry.TelemetryKt.recordEvent(Telemetry.kt:66)
    at com.google.testing.platform.executor.DeviceProviderProxy.provideDevice(DeviceProviderProxy.kt:114)
    at com.google.testing.platform.executor.SingleDeviceExecutor$execute$deviceController$1.invoke(SingleDeviceExecutor.kt:68)
    at com.google.testing.platform.executor.SingleDeviceExecutor$execute$deviceController$1.invoke(SingleDeviceExecutor.kt:68)
    at com.google.testing.platform.executor.SingleDeviceExecutor.runUnlessCancelled(SingleDeviceExecutor.kt:105)
    at com.google.testing.platform.executor.SingleDeviceExecutor.execute(SingleDeviceExecutor.kt:68)
    at com.google.testing.platform.RunnerImpl.run(RunnerImpl.kt:108)
    at com.google.testing.platform.server.strategy.NonInteractiveServerStrategy$run$4.invoke(NonInteractiveServerStrategy.kt:80)
    at com.google.testing.platform.server.strategy.NonInteractiveServerStrategy$run$4.invoke(NonInteractiveServerStrategy.kt:79)
    at com.google.testing.platform.core.telemetry.common.noop.NoopDiagnosticsScope.recordEvent(NoopDiagnosticsScope.kt:35)
    at com.google.testing.platform.core.telemetry.TelemetryKt.recordEvent(Telemetry.kt:66)
    at com.google.testing.platform.server.strategy.NonInteractiveServerStrategy.run(NonInteractiveServerStrategy.kt:79)
    at com.google.testing.platform.main.MainKt$main$4.invokeSuspend(Main.kt:67)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:274)
    at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
    at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
    at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
    at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
    at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
    at com.google.testing.platform.main.MainKt.main(Main.kt:66)
    at com.google.testing.platform.main.MainKt.main$default(Main.kt:34)
    at com.google.testing.platform.main.MainKt.main(Main.kt)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at com.google.testing.platform.launcher.Launcher.main(Launcher.java:149)

CodePudding user response:

I've had the same issue using platform-tools 33.0.3 for Linux x86-64, same version on a macOS M1 worked fine. After I tried with version 32.0.0 it worked. You can download it here.

CodePudding user response:

I upgraded AS to Electric Eel | 2022.1.1 (it did not work at the time). When I tried to run the test after a few days and after switching my computer off, it works fine.

I thinking all I had to do is restart the computer.

  • Related