Removing memory from memory after update buildToolsVersion '23 .0.1 'in Android studio

I very often go out of memory after updating buildToolsVersion '22.0.1' to buildToolsVersion '23.0.1' . I am really confused and don't know how to solve this problem, as this error only shows up with buildTools version 23.0.1 . While it works fine when I change it to 22.0.1 . Please help me. I am sending an error message that I get as follows.

 Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space Error:Execution failed for task ':app:transformClassesWithDexForDebug'. > com.android.build.transform.api.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_25\bin\java.exe'' finished with non-zero exit value 1 

build.gradle

 apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion '23.0.1' defaultConfig { applicationId "com.example.app" minSdkVersion 14 targetSdkVersion 23 versionCode 1 versionName "1.0" // Enabling multidex support. multiDexEnabled true } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile 'com.android.support:appcompat-v7:23.0.1' compile 'com.android.support:support-v4:23.0.1' compile 'com.android.support:design:23.0.0' compile 'com.android.support:cardview-v7:23.0.1' compile 'com.android.support:recyclerview-v7:23.0.1' compile 'com.android.support:palette-v7:23.0.1' compile 'com.google.android.gms:play-services:7.5.0' } 

Thanks in advance.

+74
android android-studio build.gradle build-tools android-build
Oct 12 '15 at 7:37
source share
7 answers

Add this to the Android close in the build.gradle file:

 dexOptions { javaMaxHeapSize "4g" } 

Android Studio JAR file causing GC overhead limits to be exceeded

+197
Oct 13 '15 at 12:36
source share

The accepted answer works, but I was a bit confused about where to put dexOptions in my build.gradle . We really put it under the android section.

Here is an example snippet:

 android { dexOptions { javaMaxHeapSize "4g" } ...... } 
+29
Nov 09 '16 at 13:04 on
source share

In fact, a more complex solution worked for me, which combines everything from above, plus the inclusion of multidex in the build.gradle file for the module.

but. Add this line to the defaultConfig section to enable multiDex

 // Enabling multidex support. multiDexEnabled true 

B. Then install dexOptions , for example:

 dexOptions { incremental true javaMaxHeapSize "4G" } 

C. After switching to multidex and setting the heap to 4g, an overflow error may occur that will lead to me uncommenting and changing the jvmargs line from the project’s gradle.properties file, for example:

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

Values ​​may vary depending on your device. You can also use double values.

+13
Aug 14 '16 at 12:19
source share

In addition to the above procedure, there is another option for setting jvm arguments.

 org.gradle.jvmargs="-Xms2g -Xmx4g" in gradle.properties . 

Setup is for configuring memory. Xms: run memory Xmx: maximum memory

+4
May 6 '16 at
source share

I solved this problem

  • go to the "System" section
  • Setting up the environment.
  • Change _JAVA_OPTIONS values ​​from "-Xms1024m" to "-Xms2048m"
    (if there is no Exist _JAVA_OPTIONS than create it, click "New Button").
  • ok and save reload

I think it will be useful to you. if it is helpful to answer this question.

+2
Apr 14 '16 at 16:14
source share
 dexOptions { javaMaxHeapSize "4g" } 

I ran into the same problem by adding this to the build.gradle file (module level), solving my problem

0
Nov 22 '17 at 14:05
source share

use this at the application level build.gradle:

 android { dexOptions { javaMaxHeapSize "4g" } } 
-one
Dec 18 '17 at 12:58 on
source share



All Articles