Skip to content Skip to sidebar Skip to footer

Android Studio, Configure Gradle Project Takes Forever

After changing the gradle build file to use gradle build tool 0.8.+, classpath 'com.android.tools.build:gradle:0.8.+' my Android studio is stuck forever at 'refreshing X Gradle p

Solution 1:

If you are on Windows check

C:\Users\YOUR_USER\.gradle\wrapper\dists

whether the gradle 1.10-all is installed there or not inside the directory.

Android Studio downloads the whole distribution first time which is around 60 MB so it takes some time.

Check the distributionUrl in gradle/gradle-wrapper.properties and match the same in your dist directory if it is not available studio will download it. Distribution url will look like :

distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-all.zip

change it to whatever already installed will solve the problem.

Note : The directory name in dist and Zip name must same. Directory will be created while trying to download check whether the Zip is installed properly or not.

Solution 2:

This could be anything, but in my case, it is due to an invalid HTTP proxy and some libraries can't be downloaded. In Settings-> HTTP Proxy, set to "None".

Solution 3:

I solved it

  • deleting gradle and intellij files

    rm -rf .idea/ *.iml .gradle/
    
  • reimporting the project on intellij

  • choosing same jdk for gradle that you use on gradle terminal(makes sense if you use daemon) enter image description here
  • and upgrading from gradle 2.4 to 2.13

Solution 4:

delete gradle folder in your project folder then reopen it using studio, in choose dialog choose cancel, don't use grade wrapper to download latest version of gradle

Solution 5:

If anyone face this sync stuck problem in mac, give this a try.

right click your

android studio.app -> show package -> content -> gradle

and see the gradle version. In that folder, now got to your android studio IDE and open your preference and go to

Build, execution -> build tool - > gradle

check the preference there. verify the path of gradle is as content - > .... and last there will be gradle version, see if that matched the gradle version in the content of androidStudio.app

guess this helps someone.

Post a Comment for "Android Studio, Configure Gradle Project Takes Forever"