所以我试着学习如何测试,但是我遇到了一个无法导入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'
}我需要做些什么才能让它发挥作用?
发布于 2022-04-04 00:32:35
尝试将其添加到您的依赖项中:
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'发布于 2022-04-04 01:31:41
Gradle可能会阻止您在testImplementation中使用src/main/java依赖项。如果您的测试类位于src/main/java中,请尝试将其移动到src/test/java。
https://stackoverflow.com/questions/71730831
复制相似问题