androidandroid-studioandroid-espressoandroid-testinginstrumented-test

Android studio Instrumented Test stuck at: Task :app:connectedDebugAndroidTest


I have encountered a problem that when I tried to run Android Instrument test, android studio will start building, everything is good until it stuck to this line

"> Task :app:connectedDebugAndroidTest"

and run for the next 2hrs and never proceed the actual test. What I have seen is that the test app has been successfully built into my device but just won't open and run.

Strange thing is that I have built successfully once before, but after when I tried to build again, it never success anymore. Even when I didn't change my code.

Here are the things I had tried

But still can't build!

Here is my instrument test class screen shot

Here is my instrument test class

running process screen shot

enter image description here

enter image description here

Has anyone had this problem before?


Solution

  • I started seeing the same issue after upgrading to androidx.fragment:fragment-testing:1.5.5 and androidx.test:core-ktx:1.5.0

    You can try to downgrade the versions to previous ones, or you can use next dependencies instead:

    debugImplementation("androidx.fragment:fragment-testing-manifest:1.6.0-alpha04") androidTestImplementation("androidx.fragment:fragment-testing:1.6.0-alpha04")

    You can find more info in this issue: https://issuetracker.google.com/issues/128612536