错误JUnit版本3.8或更高版本 - Android Studio

时间:2015-08-14 06:47:56

标签: java android android-studio junit

连接库JUnit,当我运行测试时,出现错误:

!!! JUnit version 3.8 or later expected:

java.lang.RuntimeException: Stub! at
    junit.runner.BaseTestRunner.(BaseTestRunner.java:5) at
    junit.textui.TestRunner.(TestRunner.java:54) at
    junit.textui.TestRunner.(TestRunner.java:48) at
    junit.textui.TestRunner.(TestRunner.java:41) at
    com.intellij.rt.execution.junit.JUnitStarter.junitVersionChecks(JUnitStarter.java:191)
    at
    com.intellij.rt.execution.junit.JUnitStarter.canWorkWithJUnitVersion(JUnitStarter.java:174)
    at
    com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:57)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497) at
    com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)

摇篮:

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2'
testCompile 'junit:junit:4.11'}

1 个答案:

答案 0 :(得分:0)

嗯,你为什么不试试

testCompile 'junit:junit:3.8'}