Fork me on GitHub

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

下载了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。

 

posted @ 2018-09-18 09:17  猫叔Vincent  阅读(9482)  评论(0编辑  收藏  举报