salmanwahed
salmanwahed

Reputation: 9647

Stuck at refreshing gradle project. What is happening under the hood?

I can not build any android project in Android Studio. Recently Android studio was updated to 2.3 as well as the gradle version. I think somewhere the update has messed up I am not sure where it is. I have deleted .gradle directory from the home folder several times by now. Changed the distributionUrl to older version of gradle. But the problem persists. Where to look at what is going on? How to solve this issue?

Upvotes: 5

Views: 15605

Answers (3)

yubaraj poudel
yubaraj poudel

Reputation: 3879

I faced this case because of slow internet, Each time while beginning with the project, it downloads the gradles taking more time.Finally refreshing complete after waiting for 10 minute.

Upvotes: 0

Kiran Benny Joseph
Kiran Benny Joseph

Reputation: 6813

I had the same problem

What I have done is

1.Close your project

2.Delete folders of .idea , .gradle, gradle folders from my project(not from home). then

3.File=>open your project

press ok in the dialogue box it will automatically set the gradle for you. or

You can specify gradle path

settings->build excecution deployment->build tools->gradle set your gradle home path to your downloaded gradle

Upvotes: 4

salmanwahed
salmanwahed

Reputation: 9647

The reason behind taking too much time on refreshing gradle project is, it was downloading gradle distribution and each time and for some network issue the download was never being completed. The zip file for gradle distribution was 91MB. So the network error + slow internet connection made it impossible task for my Android Studio. I found two solution for this:

First approach is we have to download the gradle distribution manually from services.gradle.org/distributions. Then follow the process of this answer of the question - Android Studio Stuck at Gradle Download on create new project.

Second approach is somewhat like the first approach but less complex. Download gradle distribution. Extract it somewhere. Then go to:

File > Settings > Build, Execution and Deployment > Gradle

Check Use local gradle distribution. Set the Gradle home to the folder we have extracted.

Upvotes: 11

Related Questions