How to Fix ‘Expiring Daemon because JVM heap space is exhausted’ React Native Error

Last Updated on March 25, 2021.

When you integrate heavy third-party libraries such as OneSignal, there are chances you face Expiring Daemon because JVM heap space is exhausted error. This error occurs when you try to run your react native project on Android devices.

react native jvm memory issue

The issue is Android-specific and it’s happening because allocated JVM memory is not enough to build your project. The issue can be easily fixed by increasing the JVM memory.

Go to YourProject > android > gradle.properties and search for the following line.

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

By default, the above line is commented. You just need to uncomment the line and rebuild your react native project on the Android device.

Leave a Reply

%d bloggers like this: