YPO
YPO

Reputation: 31

android studio 3.1.2: gradle sync failed: read time out on ubuntu 16.04

I start a new project on android studio 3.1.2, but it sync failed. The error message is "read time out". I've tried multiple variations of this, but none of them seem to work. It seems that android studio is unable to download the project dependencies from the remote repository. I have tried several methods including setting a http proxy, adding other repositories in the build.gradle file. Here is some message.

click to view log message

click to view build message

click to view build.gradle file

Thanks in advance!

Upvotes: 3

Views: 4897

Answers (3)

ashraf qandeel
ashraf qandeel

Reputation: 31

The problem is related to the .gradle\caches, so if you can return to the last content of your caches folder, I did that and the problem disappeared. OR File-> Invalidate Caches/Restart...

Upvotes: 0

Bebooo43
Bebooo43

Reputation: 21

i have faced the same issue, try this order it fixes the issue.

repositories {
    jcenter()
    mavenCentral()
    maven { url 'https://maven.google.com' }
    google()
}

Upvotes: 2

BNG Dev
BNG Dev

Reputation: 21

When you build project for first time, gradle sync takes time also check the internet connectivity before starting gradle sync. From the attached screenshot, sockettimeoutexception appears due to internet connectivity failure or slow connection.

Upvotes: 0

Related Questions