Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle sync failed: Connection refused

So I just installed Android Studio again after a long time and it asked me to configure the proxy, so I did. I tested the connection and it worked.

Then it asked me to configure the proxy settings for Gradl and I used the same configs.

Now, when loading the latest Vuforia Sample project, I get an error:

Gradle sync failed: Connection refused: connect

I've looked everywhere on the web, but I can't find a solution. It can't be the proxy settings, I've configured Gradle just like the IDE.

like image 771
000000000000000000000 Avatar asked Mar 31 '16 10:03

000000000000000000000


People also ask

Why is my gradle sync failing?

For this, you have to connect your PC to the internet and you have to open your Android studio. After opening your project click on the Sync Project with Gradle files option. This will automatically download the new Gradle files and will fix the issue which is caused by the Gradle files.


1 Answers

You should configure Proxy settings on Android Studios menu (File | Settings). Another strategy is to configure the file gradle.properties.

So, add theses lines for 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 others values that have special chars must have slash character such as (\#) and so on.

like image 82
e2a Avatar answered Oct 05 '22 19:10

e2a