How to optimize gradle build performance regarding build duration and RAM usage?

You need to give more memory to the Gradle JVM, not to the compile task/JVM. One way to do so is via the GRADLE_OPTS environment variable (GRADLE_OPTS=-Xmx512m).

Leave a Comment