Android studio : Gradle project sync failed error – How to Solve

By | November 23, 2016

This is the most common errors that we see in Android Studio and very often it is easy to fix.
Just follow these simple steps

  1. File -> Invalidate caches / Restart
  2. Shutdown Android Studio
  3. Rename/remove .gradle folder in the user home directory
  4. Restart Android Studio let it download all the Gradle stuff it needs
  5. Gradle build success should come(Make sure you are not behind any proxy).
  6. Rebuild project!

Try it, it should work…

6 thoughts on “Android studio : Gradle project sync failed error – How to Solve

  1. Ujjwol Dandekhya

    What do you mean by ‘.gradle’ folder?
    Do you mean “C:\Program Files\Android\Android Studio\gradle” this folder in my directory?
    It is about 140 MB of files, I want to know if its safe deleting this load of data?
    Just wanted to save the hassle of reinstalling the whole Software in case it gets messed up..

    Reply
    1. James Post author

      Ujjwol

      .gradle is a hidden file, not this one C:\Program Files\Android\Android Studio\gradle.
      Unhide all hidden folders and you will see.

      Reply
  2. yjane

    Error:Unable to start the daemon process.
    This problem might be caused by incorrect configuration of the daemon.
    For example, an unrecognized jvm option is used.
    Please refer to the user guide chapter on the daemon at https://docs.gradle.org/3.2/userguide/gradle_daemon.html
    Please read the following process output to find out more:
    ———————–
    Error: Could not create the Java Virtual Machine.
    Error: A fatal exception has occurred. Program will exit.
    Unrecognized option: –Xmx512m

    this one popped up

    Reply
  3. James Post author

    Please close all applications using java and then try deleting .gradle folder. Reinstalling gradle will bring back the folder, so don’t worry.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *