2015-08-14 54 views
0

連接庫JUnit,當我乳寧的考驗,我有一個錯誤:錯誤JUnit版本3.8或更高版本的預期 - Android Studio中

!!! 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'} 
+0

只是猜測,但你的測試'擴展TestCase'? –

+0

你有沒有檢查過這個 - http://stackoverflow.com/questions/30629314/android-studio-with-junit-4-12-junit-version-3-8-or-later-expected? – Oleksandr

+0

也檢查出http://stackoverflow.com/q/2422378/95725 – NamshubWriter

回答

0

嗯,爲什麼沒有你試試

testCompile 'junit:junit:3.8'} 

+0

似乎可行選項 – Danielson

+0

我試試3.8,4.11和其他版本。同樣的錯誤 – Sivolotskiy

+0

更改文件後,你是否與gradle同步,即乾淨的項目設置?如果這不起作用,請嘗試使緩存無效並重新啓動IDE。 –

相關問題