【问题标题】:Error JUnit version 3.8 or later expected - Android Studio错误 JUnit 版本 3.8 或更高版本预期 - Android Studio
【发布时间】:2015-11-07 08:18:13
【问题描述】:

连接库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'}

【问题讨论】:

标签: java android android-studio junit


【解决方案1】:

嗯,你为什么不试试

testCompile 'junit:junit:3.8'

?

【讨论】:

  • 似乎是一个可行的选择
  • 我尝试 3.8 、 4.11 和其他版本。同样的错误
  • 更改文件后,您是否与 gradle 同步,即清理项目设置?如果这不起作用,请尝试使缓存无效并重新启动 IDE。
  • 是的,每次更改 junit 版本后,我都会清理项目
  • 您是否也使 IDE 的缓存失效?
猜你喜欢
  • 1970-01-01
  • 2018-03-24
  • 2015-08-18
  • 1970-01-01
  • 1970-01-01
  • 2011-01-26
  • 1970-01-01
  • 2014-04-26
  • 2014-04-26
相关资源
最近更新 更多