Out of Memory Build Errors

The Gradle daemon runs on top of the Java Virtual Machine (JVM) and uses conservative memory settings by default. PSPDFKit is a large SDK, and building it might exceed the maximum memory available for the Gradle daemon. If you see the following error while building your app, your Gradle process is running out of memory:

OutOfMemoryError: GC overhead limit exceeded

To fix this issue, you’ll need to increase the heap size of the Gradle JVM. This can easily be done by modifying your gradle.properties file:

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

The -Xmx8G parameter sets the maximum heap size for Gradle JVM. We recommend 8 GB if your machine has enough memory.