Gradle proxy configuration

Cross references

  1. Gradle sync issue on Debian OS due to user does not have permission
  2. Android Gradle Plugin 3.0+ sync issue

Basically, there are TWO kind of proxies you need to configure for your gradle to work properly behind a proxy, i.e. fetching the online dependencies.

  • proxy for gradle
  • proxy for maven

Let’s assume that the proxy server and port number are as below:

  • proxy:
  • port: 8080

Proxy for gradle

Under your Android project root directory, find file and add below settings:
# Add all your hosts that should be bypassed by your proxy server.

Note that this proxy setting will apply to your gradle build commands as well.

Proxy for Maven

Because many dependencies are hosted on maven repositories, you also need to configure the maven proxy properly.

Go to the hidden maven repository directory “.m2” which is usually under your home directory “~/.m2“. If you don’t have this directory, please create it and then create the required maven setting file “~/.m2/settings.xml” with below content.

<?xml version="1.0" encoding="UTF-8"?>
<!-- To configure encrypted password see: -->
<settings xmlns="" xmlns:xsi="" xsi:schemaLocation="">
            <id>Proxy server</id>

            <id>Proxy server</id>

These two proxy settings for gradle and maven should resolve your proxy issues for fetching online dependencies.

But if you get used to command line, then probably the proxy for bash need to be configured as well.

Proxy for bash

Go to the home directory to find ~/.bashrc or ~/.bash_profile. Open it using your preferred text editor and paste below settings. 


2 thoughts on “Gradle proxy configuration

  1. Pingback: Gradle sync issue on Debian OS due to user does not have permission – Arophix

  2. Pingback: Android Gradle Plugin 3.0+ sync issue – Arophix

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s