Gradle sync failed: Connection refused

connection timed out connect gradle + intellij
how to fix connection timed out: connect in android studio
cause: connect timed out android studio
gradle sync failed no route to host connect failed
gradle sync failed: read timed out
read timed out android studio
gradle connection timed out intellij
error: connection refused (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.

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

So, add theses lines for the end of located on the app folder base.

systemProp.http.proxyHost=[IP ADDRESS]
systemProp.https.proxyPort=[PORT, TYPICALLY 3128]
systemProp.https.proxyHost=[IP ADDRESS]
systemProp.http.proxyPort=[PORT, TYPICALLY 3128]

Pay attention, the passwords and others values that have special chars must have slash character such as (\#) and so on.

Gradle sync failed: Connection timed out: connect. If you are behind , Gradle sync failed: Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy settings either in IDE or Gradle. Consult IDE log​  Gradle project refresh failed : connection timed out If you are getting this error while starting Android studio, it will be mostly because its not able to connect to Internet. Check if you are able to connect to internet from Android Studio. For this, go to File -> Settings

I caught with same issue and was trying bypass proxies in Mac. Removed proxy from system-level(bashrc) and studio( had no luck!

Found the studio unable to bypass the proxy, finally found the proxy was cahced in gradle in below file.


Essentially to make sure proxy referenes were muted in all gradle.prorties, inlcuding gradle cache.

gradle cache could be find as below(in Android view)

Please help with problems on Gradle sync failed:, Please help to solve this in Android Studio: Gradle sync failed: Connection timed out: connect. If you are behind an HTTP proxy, please  Connect to [/] failed: Connection refused: connect which seems to be a local repository or a local proxy server being at fault. check the buildscript repositories and proxy settings.

This happened to me when I updated Android Studio to the latest version.

The fix was to go to File/Settings/Build Execution Deployment/Gradle and check Use local gradle distribution

After that, in Gradle Home put the location to the gradle directory - in my case it was C:\Program Files\Android\Android Studio\gradle\gradle-3.2

Gradle build syncing fails: Connection refused. It keeps on crashing , I tried a lot of things. The only one solution that happened me somehow is Enabling embedded Maven repository. But I still get a few Errors. I have installed Android studio and i want to build first app. Unfortunately "Gradle project sync failed" Error: Connection refused: connect. I know it's because i use proxy server (my company does). I already made changes in Setings->HTTP Proxy-> Auto-detect proxy settings, but I guess, Gradle doesn't look on it.

This should work:

  1. Go to 'Gradle Scripts'

  2. Then go to ''.

  3. There you will see proxy settings something like:

    systemProp.http.proxyHost=[YOUR PROXY]


    As you may see this is for 'http' only.

  4. Just add the same for 'https':

    systemProp.https.proxyHost=[YOUR PROXY]


    Worked for me.

How To Solve and Fix Gradle Sync Failed Error In Android Studio in , How To Solve and Fix Gradle Sync Failed Error In Android Studio in HINDI i am having a error Duration: 2:26 Posted: Oct 22, 2016 Gradle sync failed: Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy settings either in IDE or Gradle. Consult IDE log for more details (Help | Show Log)

I had the same problem recently. I had my proxy setup OK but grandle could not update. After a few attempts a noticed that the "use https proxy" check button was not selected. I noticed that on the https proxy dialog which pops up while AS starts.

Keep in mind that you might cant see the https setup from File-> Settings->HTTP Proxy, so it is important to do it via the pop-up proxy dialog on AS start.You also may have HTTPS's form filled up, but you need to select that checkbox as well (at least that worked for me). So here are the steps i follow :

  1. Invalidate Caches / Restart

  2. Close any project opens by default on AS start up

  3. Select "Use https proxy on proxy dialog"

Troubleshoot Android Studio, Problem: Unable to sync Gradle whenever we import the new project with the error because of SDK components and SDK is not passing proxy connection. "Gradle project sync failed. Basic functionnality (e.g editing, debugging) will not work properly" or "Gradle 'myapp' project refresh failed: A fatal exception has occurred. Program will exit. : Gradle settings" If you have an idea of what causes this problem or if you have already encountered it, please tell me what to do. I'm using IntelliJ

Error:Unknown host You may need to adjust the , After updating to 0.4.2 I get this error when opening a project: 'Gradle project sync failed. Basic functionality (e.g. editing, debugging) will not work proprerly' The  We would like to show you a description here but the site won’t allow us.

Gradle Sync on Corporate Network/Secure Network/Proxy Network, gradle sync failed connection reset Idaily is a place to get your questions Gradle sync failed: Connection refused: connect. and deleted the lines of proxy​. shivkumar loka. Seems like gradle is trying to connect to the internet to download project dependencies and is failing to do so - hence the sync failed message. You will essentially need to tell gradle how to access network by configuring the file in your machines root.

Gradle Sync issue: Connection refused: connect, gradle sync failed connection timed out connect consult ide log for more details (​help show log), gradle sync failed unable to start the daemon  Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.) Re-download dependencies and sync project (requires network) The state of a Gradle build process may be corrupt. Stopping all Gradle daemons may solve this problem. Stop Gradle build processes (requires restart)

  • If you are having this error without using a Proxy, try File -> Invalidate Caches / Restart. It did the trick. (I also cleaned the project but I don't think it helped.)
  • I allready did that, however it did not resolve my problem! :(
  • Do you restart AS ? Do you check if Cache and Invalidate were performed ?
  • Yes! Twice at least. How do I check that?
  • Go to File | Cache and Invalidate (select restart option). Can you put his and build.gradle here (i.e., in his question) ?
  • This worked for me. Updated the file but was still facing the issue. Reason behind was presence of special characters in password.
  • Seems like when you set a proxy and then unset it, this file still holds the proxy values. Removed the proxy values and boom, it works like a charm after rebuilding my project!
  • Awesome answer! Thanks a lot!
  • Proxy settings were on C:/users/[user]/.gradle/ for me, and not on Android Studio
  • Hi there Ege, I'm having the same issue and I think it's because maybe my ISP in Russia where I'm currently visiting is blocking the connection. I've tried a VPN but no luck. Is there some way to use a VPN rather than turn it off as you say?
  • you can try to remove proxy properties in your, then Invalidate Caches finally you can re-open your VPN and start Android Studio. Perhaps you can call your ISP and ask why the hell they are blocking your connection for this though
  • Is downloading Maven dependencies the only thing Gradle would go through your proxy for? If so, this is a good answer, but you should remove the parts that are not in English.