Android Studio - with Junit 4.12 “!!! JUnit version 3.8 or later expected:”

前端 未结 14 1579
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-07 15:50

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.r         


        
14条回答
  •  庸人自扰
    2021-01-07 16:52

    Running into this when opening an old project into latest Android Studio 2.3 after it auto-updated the project.

    Android Studio supports "Android JUnit" tests which should run using the current host JRE and properly support JUnit 4+. The error is due to the wrong JRE being used.

    Solved by using Edit Configuration > select the Android JUnit configuration > edit the JRE. Select any choice, use Apply, then change it back to "Default (Android Platform)" for it work.

提交回复
热议问题