Gradle:无法通过代理

时间:2018-03-09 16:59:27

标签: gradle flutter http-proxy http-status-code-407

我正在尝试在需要基本身份验证和自签名HTTPS连接的公司代理后面运行一个空白的Flutter项目。

我在~/.gradle/gradle.properties~/.profile中添加了必要的配置。我还在$JAVA_HOME/jre/lib/security/cacerts导入了我的根证书,并告诉Gradle使用它。我甚至尝试this solution并在java.net.useSystemProxies=true中设置了$JAVA_HOME/jre/lib/net.properties

但是,它仍然没有构建,它要求进行身份验证。

flutter run
Launching lib/main.dart on Nexus 5 in debug mode...
Initializing gradle...                                0.8s
Resolving dependencies...
* Error running Gradle:
Exit code 1 from: ~/GitLab/n.gendron/techno_store/android/gradlew app:properties:
java.io.IOException: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 407 Proxy Authentication Required"
IOException: https://dl.google.com/android/repository/addons_list-3.xml
java.io.IOException: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 407 Proxy Authentication Required"
IOException: https://dl.google.com/android/repository/addons_list-2.xml
java.io.IOException: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 407 Proxy Authentication Required"
IOException: https://dl.google.com/android/repository/addons_list-1.xml
java.io.IOException: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 407 Proxy Authentication Required"
Failed to download any source lists!

This guide通过这个过程为我提供了很多帮助,this one帮助我导入了CA,但现在我被卡住了。

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

您需要在gradle / gradle.properties中编写:

# Project-wide Gradle settings.
...

systemProp.http.proxyHost=proxy.company.com
systemProp.http.proxyPort=443
systemProp.http.proxyUser=username
systemProp.http.proxyPassword=password
systemProp.http.auth.ntlm.domain=domain

systemProp.https.proxyHost=proxy.company.com
systemProp.https.proxyPort=443
systemProp.https.proxyUser=username
systemProp.https.proxyPassword=password
systemProp.https.auth.ntlm.domain=domain

...