0

I keep getting this error when I try to run my app . It's telling me

To run dex in process, the Gradle daemon needs a larger heap.
It currently has approximately 989 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.

I've been getting this error since earlier in the morning and I still can't fix it . I looked online for answers and I even tried reinstalling android studio but nothing is working . I changed the heap size and added lines to end of the code but nothing is working for me . Can someone please help ? I'm using the latest version of AS.

1 Answers1

0

I faced this issue before. Try to put this in your Module build.gradle:

android {   
     ...
    defaultConfig {
        // Enabling multidex support.
        multiDexEnabled true
    }

    dexOptions {
        incremental true
        javaMaxHeapSize "4g"
    }
}


dependencies {

    ....

    compile 'com.android.support:multidex:1.0.0'
}
Marzouk
  • 2,650
  • 3
  • 25
  • 56