In the official post detailing the features of the stable release of Android Studio 2.1, I came across this:
We are also speeding up build times by using in-process dex, which converts class files to dex files within the Gradle daemon process. This avoids the costly processing operation of creating separate dex processes. To use this feature, you will need to increase the amount of memory available to the Gradle daemon to at least 2GB (1 GB is the default).
Please, how can I increase the memory that’s available to Gradle?
In your app’s build.gradle
file, add the following:
android{
//....
dexOptions {
javaMaxHeapSize "2g"
}
}
Answer:
In Android Studio 2.1 open your gradle.properties file. Find the line
\# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
Uncomment the line. Gradle was faster after I did this.
Answer:
I have not try this but it should works:
In graddle.build file:
apply plugin: 'java'
compileJava {
//raise heap
options.fork = 'true'
options.forkOptions.with {
memoryMaximumSize = '2048m'
}
}
If it does not work in Windows try to add it to a new file gradle.properties next to gradle.build
I hope it helps you
Tags: androidandroid