walexy190
walexy190

Reputation: 41

Gradle sync failed: connection time out: consult IDE log for more details

I just installed Android studio 2.3.1, but after starting it is telling me "Grade sync failed: connection time out: connect consult IDE log for more details". Pls I don't know what to do.

Upvotes: 4

Views: 35772

Answers (10)

Nauman Rashid
Nauman Rashid

Reputation: 11

Basically it's a network issue. if you are working using wifi use vpn that would solve the problem

Upvotes: 1

Ankit Rai
Ankit Rai

Reputation: 1

Just try to use some other source internet connection instead of the one you were using while having this error.
Like I faced the same problem and I disconnected my system from the wifi and connected it to my personal mobile hotspot.
then go to file->Invalidate Caches/ Restart...
and your Gradle will build successfully this time.

Upvotes: 0

Vinit Rajpurohit
Vinit Rajpurohit

Reputation: 11

Click on the SDK Manager and click SDK Tools and check if NDK and CMAKE are checked or not. If they are not checked download and install them. And if the problem persists just try it with a stable internet connection with a fast or a moderate speed. It had happened with me also when I was doing it with mobile phone internet then I tried it with a broadband with fast internet.

Upvotes: 1

Indra Patel
Indra Patel

Reputation: 1

These situations generally occur due to the problem in downloading Gradle components, to overcome this, check your internet proxy and connection properly.

Upvotes: 0

Raj Kumar
Raj Kumar

Reputation: 1

connection timed out: solution: Just disable your anti-virus for an hour and restart the android studios, in my case my antivirus blocked the connection. while restarting the android studios firewall will ask you the permission, allow it and its all done. The gradle will build successfully

Upvotes: 0

Shreedhar A C
Shreedhar A C

Reputation: 41

In my case i activated antivirus it blocks the downloading gradle files turn of your firewall settings

Upvotes: 1

Virag Brahme
Virag Brahme

Reputation: 2062

I was facing the same issue while downloading the gradle zip from https://services.gradle.org/distributions/gradle-4.1-all.zip. My issue related to proxy settings, I disabled the proxy & click on Try Again button in build.gradle file.

enter image description here

Upvotes: 1

Reejesh PK
Reejesh PK

Reputation: 4150

With reference to @DaveNOTDavid's answer, i tried this: Go to File->Settings->Build,Execution,Deployment->Gradle-> and select "Use default gradle wrapper(recommended)". Then sync your project, everything will work fine. But you need an internet connection.

Upvotes: 1

DaveNOTDavid
DaveNOTDavid

Reputation: 1803

If you still haven't figured out this problem yet, it's because you literally have no internet connection which is mandatory for gradle building since the platform checks for potential updates for say, sdk versions, from a server.

However, if you want to build and do your work offline, then go to File -> Settings -> Build, Execution, Deployment -> Gradle -> Check Offline work under Global Gradle settings

Upvotes: 1

anisnouioua
anisnouioua

Reputation: 43

Caused by: java.util.zip.ZipException: error in opening zip file This mean that a file that Gradle has downloaded has become corrupted due to somehow or some reason. This might be the download of Gradle itself (which the wrapper does) or any dependency that Gradle has downloaded to run your build.

Gradle doesn't attempt to detect or resolve the problem, so you need to fix it manually. The solution is often to purge Gradle's download caches and let it get fresh copies of what it needs.

To do that, delete the .gradle directories in both your home directory and in your project's root directory and try building again.

In window home directory of gradle is

C:\Users\User.gradle In Mac OSX home directory

/Users/User_name/.gradle

Upvotes: 3

Related Questions