Skip to content

代理配置

yarn android时默认直连Google网络(设置全局代理仍无效)

  • 在项目android>gradle.properties配置代理后发现还是没走代理,原因不明

全局配置(推荐)

  • Windows目录:C:\Users\[USER]\.gradle\gradle.properties 不存在文件就新建一个

  • Mac目录: $HOME/.gradle/gradle.properties

shell
# gradle.properties 通用配置
# gradle proxy
systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyPort=10809
systemProp.https.proxyHost=127.0.0.1
systemProp.https.proxyPort=10809

局部配置

shell
# ...
# gradle proxy
# http(s)配置
systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyPort=10809
# 无认证请忽略
systemProp.http.proxyUser=userid
systemProp.http.proxyPassword=password
systemProp.http.nonProxyHosts=*.nonproxyrepos.com|localhost

# socks配置
systemProp.socks.proxyHost=127.0.0.1
systemProp.socks.proxyPort=10808
# 无认证请忽略
systemProp.socks.proxyUser=userid
systemProp.socks.proxyPassword=password
systemProp.socks.nonProxyHosts=*.nonproxyrepos.com|localhost