Reputation: 1270
I have couple of Android Tests in a library project in Android. When I run the tests from Android Studio it runs, but when I run it as a Gradle task it fails to run because of the following exception in the logcat at run time.
Caused by: java.lang.ClassNotFoundException:
Didn't find class "javax.swing.tree.DefaultTreeCellRenderer"
on path: DexPathList[[zip file "/system/framework/android.test.mock.jar",
zip file "/system/framework/android.test.runner.jar"
I am getting the the following error.
Tests on Nexus 5X - 8.1.0 failed: Instrumentation run failed due to 'Process crashed.'
com.android.builder.testing.ConnectedDevice > No tests found.[Nexus 5X - 8.1.0] 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).
:app:connectedDebugAndroidTest FAILED
Upvotes: 1
Views: 775
Reputation: 667
I have run into this too, especially with kotlin projects.
My workaround has been to right-click on the package(in androidTests) in the project window on the left and select 'Create All Tests...' It creates a run configuration that should work.
Upvotes: 1