以前在Android Studio 的Preference设置中,设置了socks代理后,就能够正常的进行更新和自动下载依赖,最近老是有问题,今天在添加了新的依赖后,点编译按钮就显示
Cause: dl.google.com:443 failed to respond
我尝试了重新设置socks代理,然后又把网址
https://dl.google.com/dl/android/maven2/io/reactivex/rxjava2/rxjava/2.2.19/rxjava-2.2.19.pom
自行在浏览器中打开,发现是这样的
突然想到是不是因为https的问题,于是,找到全局的gradle.properties文件,修改
## For more details on how to configure your build environment visit
# 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
#Sun Feb 28 16:59:33 CST 2021
systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyPort=1080
systemProp.https.proxyHost=127.0.0.1
systemProp.https.proxyPort=1080
为
## For more details on how to configure your build environment visit
# 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
#Sun Feb 28 16:59:33 CST 2021
systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyPort=1080
即去掉了https的代理.然后点击编译,AS就开始自动下载了.