導入android studio項目,編譯失敗


使用android studio 打開studio 工程,編譯的時候報錯:

INFO - .project.GradleProjectResolver - Gradle project resolve error
org.gradle.tooling.GradleConnectionException: Could not install Gradle distribution from 'https://services.gradle.org/distributions/gradle-2.10-all.zip'.

電腦本身已經開了vpn ,但是每次編譯的時候都報這錯誤,后來參考網上的解決方法,已經解決該錯誤,現在備注一下。

雖然已經開了vpn,為什么會報錯?

個人感覺應該是在 ~/.gradle/wrapper/dists/  目錄下有之前我不知道從那下載的 gradle-2.10-all.zip 包 (可能包有問題,所以一直裝不上),因為gradl檢測到已經有安裝包了,所以沒有從網上去重新下載它需要的那個包,所以即使開了vpn跟沒開一樣。

后來我就把 那個目錄下的包都給刪除了,gradle 應該是從那個網址上重新下載的正確的包進行的安裝。所以錯誤消失了。日!

下面是網上找到的方法:

1:


It could be that the gradle-2.1 distribution specified by the wrapper was not downloaded properly. This was the root cause of the same problem in my environment.
Look into this directory:

ls -l ~/.gradle/wrapper/dists/

In there you should find a gradle-2.1 folder. Delete it like so:

rm -rf .gradle/wrapper/dists/gradle-2.1-bin/

Restart IntelliJ after that and it will restart the download from the beginning and hopefully work.

原帖地址:http://stackoverflow.com/questions/27467155/could-not-install-gradle-distribution-from-https-services-gradle-org-distribu

2:

1、Failed to import new Gradle project: Could not install Gradle distribution from'http://services.gradle.org/distributions/gradle-1.6-bin.zip'.

問題原因:中國連接gradle的地址被強了

解決方案:修改android studio設置Http Proxy->Auto-detect proxy settings

地址:http://www.cnblogs.com/fourw/p/3198012.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM