15
Starting 0 tests on test(AVD) - 10
Tests on test(AVD) - 10 failed: Instrumentation run failed due to 'Process crashed.'

com.android.build.gradle.internal.testing.ConnectedDevice > No tests found.[test(AVD) - 10] FAILED 
No tests found. This usually means that your test classes are not in the form that your test runner expects (e.g. don't inherit from TestCase or lack @Test annotations).

So I'm running Tests on my CI and this error pops up randomly and sometimes it finds the 2 tests and runs it. But the majority of the time I'm getting this.

Willi Mentzel
  • 27,862
  • 20
  • 113
  • 121
  • 1
    Did you find any solution? Have the same with custom test runner. – Andrey Apr 01 '21 at 15:50
  • 1
    Had the same Problem today after updating some `androidTestImplementation` dependencies. Updated `androidx.test.espresso:espresso-contrib:3.3.0` to `3.4.0` which resulted in the error. Sadly I have no others insights why this happen. Hopefully it help others in the future. – Aaron Jul 14 '21 at 15:41
  • 2
    I just stumbled upon https://stackoverflow.com/questions/43041775/gradle-no-tests-found May be it is related. In that post they receive an exception which isn't shown as result of the tests but in Logcat. – Aaron Dec 08 '21 at 09:22
  • 4
    thanks for the clue @Aaron. When I checked my logcat I found `Didn't find class "androidx.test.runner.AndroidJUnitRunner"` and adding `androidTestImplementation("androidx.test:runner:1.4.0")` fixed it for me – kassim Apr 11 '22 at 12:28

1 Answers1

5

For me this happened when the test runner for the instrumented tests was wrong. I changed

android {
    // ...
    testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner"
    // ...
}

to

android {
    // ...
    testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
    // ...
}

Note that I used KTS (build.gradle.kts) but this shouldn't matter for the problem, the syntax is just slightly different.

Willi Mentzel
  • 27,862
  • 20
  • 113
  • 121