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.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Sourabh
  • 319
  • 1
  • 7
  • 17

2 Answers2

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

Community
  • 1
  • 1
Aspicas
  • 4,498
  • 4
  • 30
  • 53
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

Rob Lyndon
  • 12,089
  • 5
  • 49
  • 74
Dinesh
  • 482
  • 9
  • 20
  • your system have not enough memory free some memory this solution worked for me – Dinesh Apr 15 '16 at 12:29
  • remove any virtual device or try to clear caches. delete .gradle folder or you can search another question for opening the android studio. – Dinesh Apr 15 '16 at 12:38