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).
Run Code Online (Sandbox Code Playgroud)
所以我在 CI 上运行测试,这个错误随机弹出,有时它会找到 2 个测试并运行它。但大多数时候我都会得到这个。
对我来说,当仪器测试的测试运行程序错误时,就会发生这种情况。我变了
android {
// ...
testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner"
// ...
}
Run Code Online (Sandbox Code Playgroud)
到
android {
// ...
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
// ...
}
Run Code Online (Sandbox Code Playgroud)
请注意,我使用了 KTS ( build.gradle.kts ),但这对于问题来说并不重要,语法只是略有不同。