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

前端 未结 14 1436
爱一瞬间的悲伤
爱一瞬间的悲伤 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

    I had to update a Gradle settings file according to these instructions. I just added the line

    testImplementation 'junit:junit:4.12'
    

    to the dependencies block of my app's build.gradle file. If you check the "Project" tab in Android studio (where you can see your source code files) there should be a "Gradle Scripts" section. Look for the build.gradle file named after your package and add that line to the dependencies block, then click the "Sync now" prompt that should come up.

提交回复
热议问题