How to increase memory available for gradle

In an official post detailing the features of the stable version of Android Studio 2.1, I came across this:

We also speed up build time by using in-process dex, which converts class files to dex files in the process of the Gradle daemon. This avoids the costly processing of creating separate dex processes. To use this feature, you need to increase the amount of memory available to the Gradle daemon by at least 2 GB (default is 1 GB) .

Please, how can I increase the memory available for Gradle?

+4
source share
3 answers

build.gradle :

android{
     //....
     dexOptions {
        javaMaxHeapSize "2g"
    }
}
+12

Android Studio 2.1 gradle.properties.

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

. Gradle , .

+15

, :

graddle.build:

apply plugin: ‘java’

compileJava {
    //raise heap
    options.fork = ‘true
    options.forkOptions.with {
        memoryMaximumSize = "2048m"
    }
}

Windows, gradle.properties gradle.build

: http://www.gubatron.com/blog/2014/07/29/solved-gradle-how-to-increase-the-java-compilers-available-heap-memory/

,

0

All Articles