Expiring Daemon because JVM heap space is exhausted In React Native

By React Native debugger

You are seeing multiple times ‘Daemon will be stopped at the end of the build after running out of JVM memory’ and ‘Expiring Daemon because JVM heap space is exhausted’ then you need to improve your JVM heap memory.

Follow the below steps and crack your error

Image for post

Solution 1

Step 1: Increase Your Heap Size

Add dexOptions in your android/app/build.gradle

android {    ...    dexOptions {       javaMaxHeapSize "4g"    }
...
}

Step 2: Run Your Project

$ cd android$ gradlew clean$ cd ..$ npx react-native run-android

Solution 2

Step 1: Add below properties on your gradle.properties

Dir -Project\android\gradle.properties

org.gradle.daemon=trueorg.gradle.jvmargs=-Xmx2560m

Step 2: Run Your Project

$ cd android$ gradlew clean$ cd ..$ npx react-native run-android

Please clap and share posts on your social networks…

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store