Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Tests: No tests found

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.

like image 919
Piyush Maheswari Avatar asked Nov 16 '22 00:11

Piyush Maheswari


1 Answers

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.

like image 154
Willi Mentzel Avatar answered Jan 06 '23 17:01

Willi Mentzel