Gradlew behind a proxy

Solution 1:

All you have to do is to create a file called gradle.properties (with the properties you mentioned above) and place it under your gradle user home directory (which defaults to USER_HOME/.gradle) OR in your project directory.

Gradle (the wrapper too!!!) automatically picks up gradle.properties files if found in the user home directory or project directories.

For more info, read the Gradle user guide, especially at section 12.3: Accessing the web via a proxy

Solution 2:

If you need https access behind a proxy, please consider defining also the same set of properties for systemProp.https.

systemProp.https.proxyHost=www.somehost.org
systemProp.https.proxyPort=8080

See Can't build Android app using crashlytics behind VPN and proxy for more information.