JVM gradle arguments cannot be set in gradle.properties file for Android Studio 2.1.1

-Running Android 2.1.1 on Mac OS X

-App is not on the Android phone.

gradle.properties file contents

org.gradle.jvmargs=-Xmx2048M 

enter image description here

When the IDE hangs, it indicates that this is an unused property . It should also be dark blue, not gray.

Output:

 :MyProjectDirName:transformClassesWithInstantRunSlicerForDebug :MyProjectDirName:transformClassesWithDexForDebug To run dex in process, the Gradle daemon needs a larger heap. It currently has approximately 910 MB. For faster builds, increase the maximum heap size for the Gradle daemon to more than 2048 MB. To do this set org.gradle.jvmargs=-Xmx2048M in the project gradle.properties. For more information see https://docs.gradle.org/current/userguide/build_environment.html 

The compiler output clearly indicates that it discards the contents of the gradle.properties file.

build.gradle content

 android { dexOptions { javaMaxHeapSize "2g" } } 

Playback with these settings is also without success:

enter image description here

+10
java android-gradle
May 30 '16 at 18:11
source share
3 answers

Try adding org.gradle.daemon = true file inside gradle.properties in

 /Users/<username>/.gradle/ (Mac) C:\Users\<username>\.gradle (Windows) 

The answer is based on

stack overflow

stack overflow

+4
Jun 17 '16 at 18:44
source share

I ran into this problem. Did not find a good answer. It’s good that you can fix it in your local properties folder. But people who suggest that they work on teams of 1, or want to spend time on this fix for everyone. My group has a build server, and this is the decay point.

I have confirmed that Gradle really reads these elements and that the β€œunused” you are reading is an error. I confirmed this by changing one of the options this way

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

At what point did I receive the error message. If he did not use this resource, he would not have an error with the following

 Error:Execution failed for task ':app:mergeDebugResources'. GC overhead limit exceeded 
+3
Oct 07 '16 at 22:39
source share

This works for me:

properties file:

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

build file:

 android { ... defaultConfig { ... multiDexEnabled true } dexOptions { preDexLibraries = false; } } 
0
May 30 '16 at 19:46
source share



All Articles