打包的时候 adnroid studio卡在Gradle:Download https://services.gradle.org/distributions/gradle-2.4-all.zip解

Gradle本站镜像


使用 Android Studio开发,最痛苦的其中一项是 Maven下载数据缓慢,目前已经可以根据在Ubuntu 14.04 系统中的Apache Tomcat上部署Apache Archiva 2.2.1来使用本站的代理服务器的方式进行提速了。另一个痛苦的事情就是下载 Gradle工具包的速度异常缓慢了,不仅慢,而且还容易失败。
目前本网站已经提供了 Gradle工具包的下载代理,具体的操作就是把 services.gradle.org进行域名污染,指向本站的 IP地址 121.199.27.227。
Windows下的解决方法为修改 C:\Windows\System32\drivers\etc下的 hosts文件,里面增加如下内容:



# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host
 
# localhost name resolution is handled within DNS itself.
# 127.0.0.1       localhost
# ::1             localhost
121.199.27.227 services.gradle.org
接着修改 Android Studio项目下的 gradle\wrapper\gradle-wrapper.properties文件,把其中的




#Tue Aug 16 10:46:15 CST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
1
2
3
4
5
6
#Tue Aug 16 10:46:15 CST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
修改为:




#Tue Aug 16 10:46:15 CST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-2.14.1-all.zip
1
2
3
4
5
6
#Tue Aug 16 10:46:15 CST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-2.14.1-all.zip
注意,上面的修改其实主要是把 HTTPS修改成了 HTTP,原因在于 HTTPS无法进行域名污染。


当然,另外一个比较简单的修改方式为,只要修改 distributionUrl为本站地址,更加省事:




#Tue Aug 16 10:46:15 CST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://www.mobibrw.com/distributions/gradle-2.14.1-all.zip
1
2
3
4
5
6
#Tue Aug 16 10:46:15 CST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://www.mobibrw.com/distributions/gradle-2.14.1-all.zip
目前本站提供的 Gradle工具包版本如下:




gradle-2.14.1-all.zip


gradle-2.10-all.zip
1
2
3
gradle-2.14.1-all.zip
 
gradle-2.10-all.zip

猜你喜欢

转载自blog.csdn.net/w6718189/article/details/71439064