简体   繁体   中英

react-native run-android command errors with java.lang.outofmemoryerror

I keep getting an out of memory error whenever I try and do react-native run-android from within Visual Studio code. I've also tried just using the standard windows terminal but I get the same thing.

I've been looking at trying to increase it but it doesn't seem to help:

I've run javaw -XX:+PrintFlagsFinal | find "MaxHeapSize" javaw -XX:+PrintFlagsFinal | find "MaxHeapSize" which gives me 268435456

I then tried to increase it via 'configure java': 在此处输入图片说明

But when I run the command again I get the same number back for the heap size and if I try react-native run-android again, I get the same error.

You need to increase the heapSize for your android app. You can change the heapSize of the app in android/app/src/main/AndroidManifest.xml file.

Set android:largeHeap="true" on application tag like this.

<application
  android:largeHeap="true"

Usually apps runs without setting largeHeap:true. Make sure your coding is right and not overfetching data or something like that, before changing to largeHeap and set largeHeap to true only if necessary.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM