Gradle sync failed: Connection refused

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

    Check and review all of these files for having proxy settings:

    1. YOUR_PROJECT_ROOT/App/gradle.properties
    2. ~/.gradle/gradle.properties
    3. ~/.AndroidStudioX.Y/config/options/proxy.settings.xml

    note: replaceX.Y with your current android studio version.

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

    I find when I change the option of Preferences -> Appearance & Behavior -> System Settings -> HTTP Proxy to Manual proxy configuration, the gradle properties of the project won't change, so I add:

    systemProp.http.proxyHost= myProxyHost
    systemProp.http.proxyPort= myProxyPort
    

    Then it runs well.

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

    Amending the gradle.properties file did not work for me. What worked was manually setting the proxy in settings. Additionally I also had to enter my user name and password on for the network.

    Wish I hadn't seen this post days ago. Would have saved me time and frustration. Glad though that i persevere and found solution on my own. Mades the frustration more palatable.

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

    Go to Preferences > Appearance & Behavior > System Settings > HTTP Proxy

    If your network needs a proxy, setup Manual proxy configuration.

    Else, select Auto-detect proxy settings

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

    In your gradle.properties file inside your app project, add the following properties (both HTTP and HTTPS):

    systemProp.http.proxyHost=<proxyHost>
    systemProp.http.proxyPort=<proxyPort>
    systemProp.https.proxyHost=<proxyHost>
    systemProp.https.proxyPort=<proxyPort>
    

    If your network has a proxy (not defined in your system configuration), go to:

    File > Settings > Appearance & Behavior > System Settings > HTTP Proxy

    and setup Manual proxy configuration,

    otherwise, check Auto-detect proxy settings.

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