I'm developping an app with React native and my last version in release mode crashes after 20-30 seconds with the following generated logcat:
02-19 23:52:10.777 32717-32717/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: my.app, PID: 32717
java.lang.OutOfMemoryError: std::bad_alloc
at com.facebook.react.bridge.WritableNativeArray.pushInt(Native Method)
at com.facebook.react.modules.core.Timing$TimerFrameCallback.doFrame(Timing.java:89)
at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:134)
at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:105)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:909)
at android.view.Choreographer.doCallbacks(Choreographer.java:723)
at android.view.Choreographer.doFrame(Choreographer.java:655)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6938)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
The app never crashes in dev mode.
How can I know what causes this? Is there a leak somewhere? What steps are to be followed to know more about it?
Initially React Native was introduced just for iOS but gradually keeping its amazing features in mind, Facebook decided to introduce it for android as well. Till now the majority of the APIs are in Cross-platform which justify that developers are able to build both Android and iOS apps making use of React Native.
While you can use any editor of your choice to develop your app, you will need to install Android Studio in order to set up the necessary tooling to build your React Native app for Android.
React Native is an open-source mobile application framework created by Facebook. It is used to develop applications for Android, iOS, Web and UWP (Windows) providing native UI controls and full access to the native platform. Working with React Native requires an understanding of JavaScript fundamentals.
android/app/src/main/AndroidManifest.xml
<application
android:largeHeap="true"
Adding largeHeap seems fix it
Please refer this git issue
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With