gadfil
gadfil

Reputation: 417

How set Gradle JVM settings in Android Studio 1.3

Starting with version 1.3, Android Studio will no longer support IDE-specific Gradle JVM argument settings. Gradle JVM settings need to be set in gradle.properties files. This change is necessary to keep build output consistent, regardless of where the build is executed (IDE, command line or CI server.) If your project is using IDE-specific Gradle JVM arguments, Android Studio will, on project sync, help you copy those settings to your project's gradle.properties file. The "Gradle VM options" text field in the "Gradle" settings page has been removed as well.

I'm getting error:

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/2.4/userguide/gradle_daemon.html
Please read the following 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.  

My gradle.properties files

org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

org.gradle.parallel=true

Upvotes: 10

Views: 8006

Answers (2)

Maysam Torabi
Maysam Torabi

Reputation: 3770

Add this to your android clause in build.gradle:

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
}

Upvotes: 0

Ray Hunter
Ray Hunter

Reputation: 15557

Try changing your jvmargs to the following

org.gradle.jvmargs=-Xmx1024m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

Or something smaller -Xmx512m as your system does not have enough memory to create the object heap and thus the jvm.

You can also add the following option too:

 org.gradle.daemon=true

For those on macosx I like to add the following

-Djava.awt.headless=true

Upvotes: 1

Related Questions