使用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

posted on 2016-06-20 15:03  瓦楞球  阅读(2646)  评论(0编辑  收藏  举报