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