无法导入 JUnit 5.4
因此,我试图学习如何测试,但是我遇到了一个无法导入Junit 5.4的问题(请参阅照片: https://ibb.co/vjyd1nv )。
当我按导入它时,只需导入以下行:
testImplementation 'org.junit.jupiter:junit-jupiter'
但是错误并不能从某种原因中解决,而我无法继续……
我的依赖关系:
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
testImplementation 'junit:junit:5.4'
testImplementation 'org.junit.jupiter:junit-jupiter'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
我需要做什么才能使其正常工作?
So I was trying to learn how to test,but I faced a problem which I can't import the Junit 5.4 (See Photo: https://ibb.co/VjYd1Nv).
When I press import it just import this line:
testImplementation 'org.junit.jupiter:junit-jupiter'
But the error is NOT resolved from some reason,and I can't continue....
My Dependencies:
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
testImplementation 'junit:junit:5.4'
testImplementation 'org.junit.jupiter:junit-jupiter'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
What do I need to do to make it work ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试将其添加到您的依赖项中:
Try adding this to your dependencies:
Gradle可能会阻止您在
src/main/java
中使用证词依赖关系。如果您的测试类位于src/main/java
中,请尝试将其移至src/test/java
。Gradle might prevent you from using testImplementation dependencies in
src/main/java
. If your test class is located insrc/main/java
, try moving it tosrc/test/java
.