情况一:使用Shadowsocks代理PAC自动代理或者全局代理,Gradle同步速度慢,一直卡在Resolving dependencies ':classpath',下载速度慢。
情况二:关掉Shadowsocks代理,Gradle同步报错,本地连接被拒绝(Connect to 127.0.0.1:1086 [/127.0.0.1] failed: Connection refused: connect),国内依赖库下载连接也被拒绝。
解决:
1、国内的依赖库,不需要代理翻墙同步下载
2、关掉Shadowsocks后,出现接被拒绝原因是Gradle有设置默认的代理配置,只要把默认代理注释掉,Gradle就可以正常同步了。
Mac
/Users/lmz14/.gradle/gradle.properties
# http://www.gradle.org/docs/current/userguide/build_environment.html
#
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx1024m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
#
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#
# -------注释掉以下默认代理--------
# Sat Sep 29 16:29:38 CST 2018
# systemProp.http.proxyHost=127.0.0.1
# systemProp.https.proxyPort=1086
# systemProp.https.proxyHost=127.0.0.1
# systemProp.http.proxyPort=1086
Window
.gradle下不存在gradle.properties文件,创建gradle.properties文件。
网友评论