2

I am trying to run a blank Flutter project behind a corporate proxy requiring basic authentication and self-signing HTTPS connections.

I added the necessary config in ~/.gradle/gradle.properties and in ~/.profile. I also imported my root certificate in $JAVA_HOME/jre/lib/security/cacerts and told Gradle to use it. I even tried this solution and set java.net.useSystemProxies=true in $JAVA_HOME/jre/lib/net.properties.

But, still, it doesn't build, and it asks for authentication.

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 helped me a lot trough this process, and this one helped me import the CA, but now I'm stuck.

Any idea?

NatoBoram
  • 1,933
  • 2
  • 18
  • 42
  • Did you solved this problem? – Mariano Argañaraz Jul 06 '18 at 16:13
  • 1
    No, the problem wasn't solved. We temporary made a hole in our security systems just to allow Flutter to download itself. I really wish Java respected the system's configuration to access Internet and didn't try to be a smart-ass about it. – NatoBoram Jul 09 '18 at 02:26

1 Answers1

0

You need in gradle/gradle.properties write:

# 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

...