Gradle sync failed: Connection refused

后端 未结 29 2843
小鲜肉
小鲜肉 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:45

    This should work:

    1. Go to 'Gradle Scripts'

    2. Then go to 'gradle.properties'.

    3. There you will see proxy settings something like:

      systemProp.http.proxyHost=[YOUR PROXY]

      systemProp.http.proxyPort=[PORT]

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

    4. Just add the same for 'https':

      systemProp.https.proxyHost=[YOUR PROXY]

      systemProp.https.proxyPort=[PORT]

      Worked for me.

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

    A lot of people suggested changing proxy settings but that was not my problem. At the time of writing com.android.tools.build:gradle:3.3.2 was recently released and i was not able to update to that from my network.

    However , com.android.tools.build:gradle:3.3.1 was available and it no longer threw that errror

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

    I have the same problem.can't connect to socks proxy connection refused. try

    1.turn off vpn

    2.File -> Invalidate Caches / Restart

    This operation can fix this problem

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

    When I got this error I used Charles Proxy app(even thought Charles Proxy was completely closed). To solve it I just disabled SSL Proxying inside Charles Proxy

    After that I got

    Cause: unable to find valid certification path to requested target
    //and
    Connection refused
    

    To solve it just close Charles Proxy(with disabled(stopped) SSL Proxying) and restart Android Studio or analyse traffic and exclude unnecessary host(Proxy -> SSL Proxy Settings... -> Exclude block). In my case it was

    <some_digits>.cloudfront.net
    
    0 讨论(0)
  • 2020-11-29 10:46

    File > Settings... > Buil, Execution, Deployment > Gradle >Android Studio Check "Enable embedded Maven repository"

    É seja feliz. Por nada!

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

    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.

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