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
Do not forget proxy for https in gradle.properties
systemProp.http.proxyHost=your.proxy.host
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=username
systemProp.http.proxyPassword=password
#
# DO NOT forget https proxy, too!
#
systemProp.https.proxyHost=your.proxy.host
systemProp.https.proxyPort=8080
systemProp.https.proxyUser=username
systemProp.https.proxyPassword=password
I solved my problem by turning off my anti-virus (avast)
I got the very same problem.
In my case, I started my android project on campus. Everything was fine then. When came home and started using the wifi I got the same problem (Gradle sync failed: Connection timed out).
All did is modify gradle.properties file under Gradle Scripts. I just removed the proxy settings that were stored in that file. Everything's back to normal now.
Below is an image of where to find the file: