Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 331
salmanwahed Avatar asked Mar 04 '17 10:03

salmanwahed


People also ask

What does refresh gradle project do?

Reload a linked Gradle project In the Gradle tool window, right-click a linked project. On invoking this action, IntelliJ IDEA parses the project structure in the Gradle tool window. IntelliJ IDEA cannot reload just a part of your project, it reloads the whole project including modules and dependencies.

How long does gradle project sync take?

One bit of a downside is that it takes roughly 3 minutes to re-sync when we "Import Gradle Project". There is no feedback to tell us what it is doing, so it's hard to know what we might tweak to see if we can get it faster. We are on the latest - 2019.2. x.


2 Answers

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.

like image 101
salmanwahed Avatar answered Oct 13 '22 00:10

salmanwahed


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

like image 35
Kiran Benny Joseph Avatar answered Oct 13 '22 01:10

Kiran Benny Joseph