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。

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM