Gradle(w) and Proxy Authentication

The recent updates in Android Studio eliminate the possibility of passing JVM arguments to gradle. That’s quite unfortunate because I quite liked my solution and now I was getting a (not) nice Connection refused message… So I had to find a different solution.

Environment Variable

As always, everything related to Java can be configured via an environment variable. if you set GRADLE_OPTS, it’ll get passed to gradlew as JVM arguments. My GRADLE_OPTS looks like this now:

You should need to set up the https variants because downloads are made via https, not http. The user name and password are the same as for http. if youre proxy is not authenticated, then good for you. I’m not that lucky :)

The advantage of this approach is that gradlew can make use of it.

Gradle Configuration

The same as above can be done in the file. This will make the settings available to gradle commands. My file looks like this now:

For some reason it would not work with gradlew, but I haven’t lingered too much on it. If you find this solution works with gradlew without the environment variable, let me know!


A little experiment: If you find this post and ad below useful, please check the ad out :-)

2 thoughts on “Gradle(w) and Proxy Authentication

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to top