Reputation: 3737
Problem
when executing Robolectric tests, I receive:
java.lang.NoClassDefFoundError: androidx/test/runner/MonitoringInstrumentation
No duplicate question:
I read the other topics which pop up when using google or stackoverflow search but they are about a more specific error which is worked-around via adding specific dependencies. In my case I was not able to determine which dependency to add.
Upvotes: 1
Views: 1025
Reputation: 3472
I add dependencies to androidx.test:core for the build type under test.
In my case it was debug so in the build.gradle I add
debugImplementation 'androidx.test:core:1.2.0'
Upvotes: 1
Reputation: 3737
I read that no workaround should be required with Android Studio 3.3 and Robolectric 4.0.
This works for me.
Upvotes: 0