Tried out the suggestions on this post, but I still get the error:
!!! JUnit version 3.8 or later expected: java.lang.RuntimeException: Stub! at junit.runner.BaseTestRunner.<init>(BaseTestRunner.java:5) at junit.textui.TestRunner.<init>(TestRunner.java:54) at junit.textui.TestRunner.<init>(TestRunner.java:48) at junit.textui.TestRunner.<init>(TestRunner.java:41) Process finished with exit code -3
Not sure what to do from here. Tried reorganizing the order of the Junit dependency. No luck, anyone else get this issue?
Android Studio V. 1.2.1.1
When you run JUnit from IntelliJ, the very first line of the console output displays your classpath. You can use Ctrl+F to find any "junit" references.
AndroidX Test is a collection of Jetpack libraries that lets you run tests against Android apps. It also provides a series of tools to help you write these tests. For example, AndroidX Test provides JUnit4 rules to start activities and interact with them in JUnit4 tests.
Solved the issue. I was running the JUnit tests as a standard "JUnit test" in Android Studio
. I fixed the issue by resetting the configuration as a Android Test
.
Just to add one more situation. I was having this error after updating Android Studio to 4.1 on a project using old AGP (3.3.2) and Gradle (4.10.2). What ended up solving the issue for me was removing the android.test.runner
library from gradle dependencies, that is removing the following line from the app's module build.gradle
:
useLibrary 'android.test.runner'
I probably got lucky to not actually need any of the classes provided by the library for unit or instrumented tests.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With