java – Android Studio Gradle project sync failed-ThrowExceptions

Exception or error:

I’m getting error:
“Gradle project sync failed. Basic functionality (e.g. eiditing) will not work properly.”

And Error Log:

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 http://gradle.org/docs/1.10/userguide/gradle_daemon.html 
Please read below process output to find out more:
    ----------------------- 
Error occurred during initialization of VM Could not reserve enough space for object heap Error: Could not create the Java Virtual Machine. 
Error: A fatal exception has occurred. Program will exit.

I was trying to delete .gradle folder as I read here. This worked yesterday but today when I started Android Studio the error showed again and deleting .gradle folder doesn’t help.

I realy don’t know what to do.

Does anyone have any suggestions?

How to solve:

Just a blind guess: try to add something like this to your gradle.properties file in the project:

org.gradle.jvmargs=-Xmx512m -XX:MaxPermSize=512m

###

Same issue solve in Android studio by

File -> Settings -> Compiler (Gradle-based Android Projects)

Change the "**VM options**" to 
-Xmx512m -XX:MaxPermSize=512m

It worked for me .

###

The only way I’ve been able to fix this when it happens is by doing

./gradlew clean 

and

./gradlew --refresh-dependencies

and then restarting Android Studio.

If that doesn’t work I usually resort to reimporting the project.

###

I had the Same Issue, and Searched for almost 4 Days but can’t able to solve the problem.

But at Last I can able to solve the problem, and for that please follow the steps.

Step 1: Check Your Java Version.

Step 2: If It is 1.7 then Download the New Version i.e JDK 1.8

Step 3: Install JDK 1.8

Step 4: Change the Java Version of Android Studio to 1.8 and the
problem solved…

It Worked for me.

###

changing compile setting to this worked for me

enter image description here

###

I was getting the same error in version 2.2.3,So I downloaded the latest Android Studio version 2.3.3, even in the latest version, I was getting the same error, below is my solution :-

  1. Download the latest version of Android Studio from the official site.

  2. In File>Project Structure>SDK Location, JDK Location should refer a 64-bit JDK ex. C:\Program Files\Java\jdk1.8.0_131, even after this, error was not fixed completely.

  3. I checked the project structure, In the File>Project Structure>Project , the Android Plugin version was still 2.2.3, I changed it to 2.3.3 and the build is successful and everything is working smoothly.

###

This one worked for me.

  1. Close the Android Studio
  2. Delete .gradle folder from c:\users\{username}\.gradle
  3. Open the Android Studio
  4. Clean Project
  5. Rebuild Project
  6. Sync Project with gradle files. See screen shot

    Cheers!

###

Check if the gradle path in File -> Settings -> Build, Execution -> Gradle is correct. I had incorrect path to local gradle distribution there.

###

None of these worked for me, so this is how I eventually solved my problem:

  • In the top-level build build.gradle file, remove
    ‘classpath ‘com.android.tools.build:gradle:some version number
  • sync your project and make sure your gradle location is pointing at the correct directory

###

Updating Java and the problem is solved!

Control panel > Java > Update Now

###

I was in that situation, finding near no solution; finally I realized that my firewall was blocking java executable from opening ports/connecting. Try adding a firewall exception for the Java executable. This solved the problem for me.

Leave a Reply

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