OlivierGrenoble
OlivierGrenoble

Reputation: 4143

Proxy issue with Android Studio 3

I have a crazy issue with Android Studio proxy.

So far, I was using Android Studio 2.3.1 and the proxy was working fine (I have to use a proxy with authentication). In Android Studio "Settings" menu, there is a "Check connection" button. It says that the connection is successful.

Yesterday, I have moved to Android Studio 3.1.4. With this version, the proxy authentication always fails with error 407:

Unable to tunnel through proxy. Proxy returns "HTTP/1.1 407 Proxy Authentication Required"

I have tried a lot of things without success. The most promising one was found here It says:

Change in Java 8 Update 111: Now, proxies requiring Basic authentication when setting up a tunnel for HTTPS will no longer succeed by default. If required, this authentication scheme can be reactivated by removing Basic from the jdk.http.auth.tunneling.disabledSchemes networking property, or by setting a system property of the same name to "" ( empty ) on the command line.

I have followed the advice and edited my net.properties file to remove the word "basic" at the end of 'jdk.http.auth.tunneling.disabledSchemes' but the issue is still there.

I have then moved back to Android Studio 2.3.1 and I can see that the proxy is working. I'm wondering what's wrong with Android Studio 3.1.4 and I'm stuck :o(

By the way, I'm on Ubuntu 16.04 and I'm using Java8 from Oracle (/usr/lib/jvm/java-8-oracle)

Thanks for any advice.

Upvotes: 2

Views: 3109

Answers (1)

OlivierGrenoble
OlivierGrenoble

Reputation: 4143

I had to do 3 things to get Android Studio 3.2 working with ZScaler Proxy:

1. gradle.properties:

So far we were used to use a « gradle.properties » file per project. There is now a global one in ".gradle" directory. Check that it contains the correct informations about your proxy.

2. Certificates:

I have followed some of the useful hints found on https://sacha-k.github.io/2017/04/18/Android-Studio-behind-Zscaler.html

I have downloaded the ZScaler certificates from Chrome (exported in "Base-64 encoded X.509" .cer format). In a file explorer go to the Android Studio directory and then in jre/bin subdirectory:

keytool.exe -import -alias Zscaler -file C:\Zscaler.cer -keystore ../jre/lib/security/cacerts

NB : The default password for the certificate store is “changeit”

Do the same thing for every ZScaler certificates.

3. net.properties

Quote: “Now, proxies requiring Basic authentication when setting up a tunnel for HTTPS will no longer succeed by default. If required, this authentication scheme can be reactivated by removing Basic from the jdk.http.auth.tunneling.disabledSchemes networking property”

Android Studio doesn’t use the system JRE present on your machine but embeds its own JRE version. In Android Studio directory, go to jre/jre/lib and open the file “net.properties”. Edit this file and remove the word “basic”:

  #jdk.http.auth.proxying.disabledSchemes=
  jdk.http.auth.tunneling.disabledSchemes=basic

With all this changes, I now have the proxy working with Android Studio 3.

Upvotes: 1

Related Questions