Gradle sync failed: Connection refused

后端 未结 29 2840
小鲜肉
小鲜肉 2020-11-29 10:14

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

相关标签:
29条回答
  • 2020-11-29 10:26

    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

    0 讨论(0)
  • 2020-11-29 10:26

    I am writing on this old post as I have also faced the same problem after updating the Android Studio to 3.5. I was not using any proxy setting in my current project, still, it was showing me connection refused error. To resolve this problem I deleted the .android and .gradle file from User folder and restarted the android studio. It helped me to rebuild the project successfully.

    Hope it will help you out.

    0 讨论(0)
  • 2020-11-29 10:29

    For me it worked like this:

    1. -turned off firewall and antivirus
    2. -deleted .gradle file. location: C:\Users\user\.gradle
    3. -restarted android studio
    4. -checked internet connection

    P.S. There is no proxy in my system (windows 8.1)

    and it worked! hope this helps.

    0 讨论(0)
  • 2020-11-29 10:31

    This worked for me

    1. commented this lines in gradle properties
    systemProp.https.proxyPort=41258 
    systemProp.http.proxyHost=109.199.77.83
    systemProp.https.proxyHost=109.199.77.83
    systemProp.http.proxyPort=41258
    
    1. use vpn
    2. rebuild project
    0 讨论(0)
  • 2020-11-29 10:31

    I solved my problem by putting the proxy options with http and https. Before it was just http and was giving error, after I added https, it worked.

    0 讨论(0)
  • 2020-11-29 10:32

    I've searched everywhere for the answer spend 3 days and finely find the solution is to disable Avast in my case, so if you are too had an antivirus try it or make an exception for Android Studio.

    0 讨论(0)
提交回复
热议问题