Error “Gradle sync failed: Connection refused: connect”

You should configure Proxy settings in Android Studio’s menu (FileSettings). Another strategy is to configure the file gradle.properties.

So, add these lines at the end of gradle.properties, located on the app folder base.


systemProp.http.proxyPassword=[PASSWORD]
systemProp.http.proxyHost=[IP ADDRESS]
systemProp.https.proxyPort=[PORT, TYPICALLY 3128]
systemProp.https.proxyUser=[USERNAME]
systemProp.https.proxyHost=[IP ADDRESS]
systemProp.https.proxyPassword=[PASSWORD]
systemProp.http.proxyPort=[PORT, TYPICALLY 3128]
systemProp.http.proxyUser=[USERNAME]

Pay attention. The passwords and other values that have special characters must have slash character such as (\#) and so on.

Leave a Comment