Android Studio: Gradle sync failed: Connection timed out: connect

后端 未结 15 2508
情话喂你
情话喂你 2020-12-06 04:28

My Android Studio was working fine till morning, but since tonight I get error saying \"Gradle sync failed: Connection timed out: connect. If you are behind an HTTP proxy, p

相关标签:
15条回答
  • 2020-12-06 05:07

    Clear proxy setting at gradle.properties (Global properties)

    0 讨论(0)
  • 2020-12-06 05:07

    What worked for me was removing the port settings from the Gradle.properties file. I wasn't using any proxy and that resulted in the mismatch. I commented out the following lines

    systemProp.https.proxyPort=your_port

    systemProp.http.proxyHost=your_proxy

    0 讨论(0)
  • 2020-12-06 05:08

    If your Proxy settings is set to No Proxy [Based on how i solved this issue in my case] check out gradle.properties (Global properties) and clear proxy lines.

    #systemProp.https.proxyPort=port
    #systemProp.http.proxyHost=proxy
    org.gradle.jvmargs=-Xmx2048m -XX\:MaxPermSize\=512m -XX\:+HeapDumpOnOutOfMemoryError -Dfile.encoding\=UTF-8 -Djava.net.preferIPv4Stack\=true
    org.gradle.daemon=true
    #systemProp.https.proxyHost=proxy
    org.gradle.configureondemand=false
    #systemProp.http.proxyPort=port
    android.enableBuildCache=true
    
    0 讨论(0)
  • 2020-12-06 05:09

    For me it was the firewall. Definitely, only that. After adding Android Studio to it's whitelist everything is working like a charm.

    0 讨论(0)
  • 2020-12-06 05:14

    I copied a project that was created else where. After removing these proxy credentials:

    systemProp.http.proxyPassword=your_password
    
    systemProp.http.proxyHost=host_Ip_address
    
    systemProp.http.proxyUser=your_username
    
    systemProp.http.proxyPort=port_number
    

    in the gradle.properties, it worked like a charm.

    0 讨论(0)
  • 2020-12-06 05:15

    If proxy settings are correct then go to file and click on "Invalidate Caches/Restart..." to invalidate the cache and restart android studio.

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