Android Studio: Could not download junit.jar (junit:junit:4.12)

随声附和 提交于 2020-01-16 03:00:06

下载了Android Studio 3.1.4,新建一个项目,选择Activity,结果gradle提示

Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not download junit.jar (junit:junit:4.12)
Open File
Show Details


Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not download junit.jar (junit:junit:4.12)
Open File
Show Details


Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not download junit.jar (junit:junit:4.12)
Open File
Show Details

 

 

解决方法

1、下载junit

点击 https://jcenter.bintray.com/junit/junit/4.12/junit-4.12.jar,放在...\Android Studio\gradle\gradle-4.4\lib\plugins中,并重启Android Studio。

不过这个plugins都会有junit包的。

 

2、注释bulid.gradle中的junit行,看图,顺便注释一下 androidTestImplementation。

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!