Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

Please help with problems on Gradle sync failed:

Please help to solve this in Android Studio: Gradle sync failed: Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy settings either in IDE or Gradle.

shivkumar loka
shivkumar loka
4,066 Points

Hey Noel,

Seems like gradle is trying to connect to the internet to download project dependencies and is failing to do so - hence the sync failed message. You will essentially need to tell gradle how to access network by configuring the gradle.properties file in your machines root. You can look at configuring your network settings as follows:

Configuring an HTTP proxy

gradle.properties

systemProp.http.proxyHost=www.somehost.org
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=userid
systemProp.http.proxyPassword=password
systemProp.http.nonProxyHosts=*.nonproxyrepos.com|localhost

There are separate settings for HTTPS.

Configuring an HTTPS proxy

gradle.properties

systemProp.https.proxyHost=www.somehost.org
systemProp.https.proxyPort=8080
systemProp.https.proxyUser=userid
systemProp.https.proxyPassword=password
systemProp.https.nonProxyHosts=*.nonproxyrepos.com|localhost

You can also try marking - work in offline mode to see if the error message changes - to confirm that the problem actually occurs when gradle tries to connect to the network.

Refer to this link for more information: https://docs.gradle.org/current/userguide/build_environment.html#sec:accessing_the_web_via_a_proxy

Thanks let me try it

I have configured my gradle.properties as below, but still having the same error. The details below are the proxy parameters for my internet connection

systemProp.http.proxyPassword=chiwanga systemProp.http.proxyHost=192.168.1.64 systemProp.http.proxyPort=8080 systemProp.http.proxyUser=netone\noelc