androidjunitjunit4android-studio-4.1

JUnit version 3.8 or later expected on android studio 4.1


I have updated the Android studio to 4.1 and when I run JUnit I get below eorror

 !!! JUnit version 3.8 or later expected:

java.lang.RuntimeException: Stub!
    at junit.runner.BaseTestRunner.<init>(BaseTestRunner.java:14)
    at junit.textui.TestRunner.<init>(TestRunner.java:54)
    at junit.textui.TestRunner.<init>(TestRunner.java:48)
    at junit.textui.TestRunner.<init>(TestRunner.java:41)
    at com.intellij.rt.junit.JUnitStarter.junitVersionChecks(JUnitStarter.java:212)
    at com.intellij.rt.junit.JUnitStarter.canWorkWithJUnitVersion(JUnitStarter.java:195)
    at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:49)

Below is my configuration

JUnit Version: 4.12

Mockito Version: 3.5.11

PowerMockito Version: 2.0.7

Espresso Version: 3.3.0

Gradle Plugin version: 4.0.2 and 4.1.0

Gradle Version: 6.1.1 and 6.5

When I donwngradle to 4.0.2 it works fine

Please tell me what I am missing..


Solution

  • I had the same issue when I upgrade to AS 4.1

    I resolved this by removing the following from the build.gradle (app) file

    useLibrary 'android.test.runner'
    

    All tests run to completion