Abh*_*waj 5 java eclipse junit android android-studio
我的项目运行成功,期望在清理并重建项目时出现此错误
Information:Gradle tasks [clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:compileDebugSources, :app:compileDebugAndroidTestSources, :app:compileDebugUnitTestSources]
D:\Gonna Projects\DoctorApps\app\src\androidTest\java\in\doctormobileapps\doctorapps\ExampleInstrumentedTest.java
Error:(4, 28) error: package android.support.test does not exist
Error:(5, 35) error: package android.support.test.runner does not exist
Error:(7, 17) error: package org.junit does not exist
Error:(8, 24) error: package org.junit.runner does not exist
Error:(11, 24) error: package org.junit does not exist
Error:(18, 2) error: cannot find symbol class RunWith
Error:(20, 6) error: incompatible types: Test cannot be converted to Annotation
Error:(23, 30) error: cannot find symbol variable InstrumentationRegistry
Error:Execution failed for task ':app:compileDebugAndroidTestJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
Information:BUILD FAILED
Information:Total time: 4.834 secs
Information:9 errors
Information:0 warnings
Information:See complete output in console
Run Code Online (Sandbox Code Playgroud)
有人可以告诉我我怎么了吗?
小智 5
看来您尚未将Junit-Package添加到模块的build.gradle文件中。只需将其添加到依赖关系块中,它就可以工作:
androidTestCompile 'junit:junit:4.12'
testCompile 'junit:junit:4.12'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8496 次 |
| 最近记录: |