2

I update my Android Studio and try to run an app but it shows the error like this..

Error:Execution failed for task ':app:transformClassesWithDexForDebug'.> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded

before updation of Android Studio same app run fine, so i tried to solve the issue i found only one which is i already done into gradle file..

dexOptions {
    incremental true
    javaMaxHeapSize "4g"
}

So now what can i do to solve this issue, please help me out. Thanks.

2
  • android:largeHeap="true" in AndroidManifest.xml in application tag and clear cache ! Commented Apr 15, 2016 at 11:23
  • That's not working Commented Apr 15, 2016 at 11:36

2 Answers 2

3

Add this to your gradle.properties file.

# The Gradle daemon aims to improve the startup and execution time of Gradle.
# When set to true the Gradle daemon is to run the build.
org.gradle.daemon=true

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
org.gradle.parallel=true

# Enables new incubating mode that makes Gradle selective when configuring projects.
# Only relevant projects are configured which results in faster builds for large multi-projects.
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:configuration_on_demand
org.gradle.configureondemand=true

And on my build.gradle :

....
     dexOptions
         {
               incremental false
               javaMaxHeapSize "2048M" 
               preDexLibraries = false
         }//end dexOptions

....

Found Here

And My answer Here

Sign up to request clarification or add additional context in comments.

Comments

1
  1. go to "System Properties" -> "Advanced"
  2. Environment Variables
  3. Edit _JAVA_OPTIONS values from "-Xms1024m" to "-Xms2048m"
    (if not Exist _JAVA_OPTIONS then create it by clicking on New Button)
  4. Ok, save and restart system

I think it will be helpfull for you

2 Comments

your system have not enough memory free some memory this solution worked for me
remove any virtual device or try to clear caches. delete .gradle folder or you can search another question for opening the android studio.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.