Hadi Mohammadi
Hadi Mohammadi

Reputation: 434

Gradle Sync Connection Timeout

I often get the following error while trying to sync gradle

Error:Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy settings either in ide or gradle.

Sometimes that i don't get the error, gradle sync takes more than 1 hour

Upvotes: 3

Views: 12882

Answers (3)

Sathesh
Sathesh

Reputation: 61

I Just encounter the same issue in my office network.

By default the "HTTP Proxy" is set to "No Proxy" in Android Studio.

I fix this the problem by making "HTTP Proxy" to "Auto Detect".

Upvotes: 2

treatheat
treatheat

Reputation: 41

If it was working fine earlier and stopped all of a sudden, try removing any recent dependency that you have added and sync again. If you can't recall then try running it in offline mode.

Upvotes: 0

Dexto
Dexto

Reputation: 1201

Try to open and check this url in your browser Google DL and try downloading latest Gradle version from Gradle Site

If you aren't able to access and download the files the time consumption is because you might be getting 403. You might not be having download access on your machine. Contact your network administrator and ask for access.

Configure your gradle.properties with below settings -

systemProp.http.proxyPassword=
systemProp.http.proxyHost=
systemProp.http.proxyPort=
systemProp.http.proxyUser=

systemProp.https.proxyPort=
systemProp.https.proxyUser=
systemProp.https.proxyHost=
systemProp.https.proxyPassword=

Or you can go to Settings -> HTTP Proxy -> Provide details.

Now go to SDK Manager -> Tools -> Options -> Set provided proxy server and port.

Rebuild your project, you would be prompted with proxy dialog -> Check https proxy and build.

EDIT 1

If above solution does not work. Go to settings -> Search Gradle -> Check offline mode under Global gradle settings.

Upvotes: 3

Related Questions