This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/react-native/troubleshooting/out-of-memory-error-react-native-android.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Out of memory error while building React Native for Android

You might run into a java.lang.OutOfMemoryError error while trying to build React Native for Android emulators and Android devices.

You can explore some of the solutions discussed in this known React Native issue(opens in a new tab).

You can also try adding org.gradle.jvmargs=-Xmx4608m to the gradle.properties file in the android folder of your React Native project.

Your gradle.properties file might look like this:

org.gradle.jvmargs=-Xmx1536M
org.gradle.configureondemand=false
android.useAndroidX=true
android.enableJetifier=true