AndroidX Test JUnit 中出现“Failed to resolve: org.junit:junit:4.12”错误。

3
当我尝试添加 AndroidX Test JUnit 1.0.0-beta01 的依赖时:androidTestImplementation androidx.test.ext:junit:1.0.0-beta01,Gradle 同步失败并显示以下错误:

无法解析:org.junit:junit:4.12

手动添加 org.junit 依赖的所有操作也没有起到帮助作用。

使用 testImplementation 'junit:junit:4.12' - ॐ Rakesh Kumar
@RakeshKumar 这个依赖项存在,但并没有改变任何东西。 - qwertyfinger
我遇到了同样的问题。我们正在尝试用ext版本替换已弃用的AndroidJUnit4,但是出现了org.junit:junit:4.12的问题。 - SamIAmHarris
2个回答

3

上述问题已在1.0.0-beta02中得到修复。

'androidTestImplementation "androidx.test.ext:junit:1.0.0-beta02'

(意为引入Android测试库)


2
您可以手动排除“org.junit”组。
androidTestImplementation("androidx.test.ext:junit:1.0.0-beta01") {
    exclude group: "org.junit"
}

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接