简体   繁体   English

由于一些内存不足错误,React本机应用程序崩溃如何解决此问题

[英]React native app crashes due to some out of memory error how to fix this

Because of the below error app crashes , i couldn't figure out what is the exact problem and what is the cause 由于以下错误应用崩溃,我无法弄清楚到底是什么问题,是什么原因

java.lang.RuntimeException: 
      at com.facebook.react.bridge.JavaMethodWrapper.invoke (JavaMethodWrapper.java:383)
      at com.facebook.react.bridge.JavaModuleWrapper.invoke (JavaModuleWrapper.java:160)
      at com.facebook.react.bridge.queue.NativeRunnable.run (Native Method)
      at android.os.Handler.handleCallback (Handler.java:751)
      at android.os.Handler.dispatchMessage (Handler.java:95)
      at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage (MessageQueueThreadHandler.java:29)
      at android.os.Looper.loop (Looper.java:154)
      at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run (MessageQueueThreadImpl.java:192)
      at java.lang.Thread.run (Thread.java:762)
    Caused by: java.lang.reflect.InvocationTargetException: 
      at java.lang.reflect.Method.invoke (Native Method)
      at com.facebook.react.bridge.JavaMethodWrapper.invoke (JavaMethodWrapper.java:372)
    Caused by: java.lang.OutOfMemoryError: 
      at java.lang.AbstractStringBuilder.<init> (AbstractStringBuilder.java:64)
      at java.lang.StringBuilder.<init> (StringBuilder.java:98)
      at libcore.net.UriCodec.decode (UriCodec.java:273)
      at android.net.Uri.decode (Uri.java:1946)
      at android.net.Uri$AbstractPart.getDecoded (Uri.java:1976)
      at android.net.Uri$StringUri.getSchemeSpecificPart (Uri.java:560)
      at cl.json.ShareFile.isBase64File (ShareFile.java:66)
      at cl.json.ShareFile.isFile (ShareFile.java:61)
      at cl.json.social.ShareIntent.open (ShareIntent.java:74)
      at cl.json.social.GenericShare.open (GenericShare.java:18)
      at cl.json.RNShareModule.open (RNShareModule.java:94)

My understanding is that there are two ways to analyze this: 我的理解是有两种分析方法:

  1. Integrate a tool like Crashlytics in your app and let it help you 将像Crashlytics这样的工具集成到您的应用中,让它为您提供帮助
  2. Try to figure out which part of your code caused this. 尝试找出导致此问题的代码的哪一部分。 This is possible if the crash occurs when you do something specific in the app which causes the crash. 如果您在应用中执行特定操作导致崩溃时发生崩溃,则有可能发生这种情况。 If it happens arbitrarily, this approach won't work. 如果任意发生,则此方法将行不通。 If, however, the crash happens when you render a specific component, or when you execute a specific function, then you can try commenting out parts of the code, and by trial-and-error, pinpoint the problematic code. 但是,如果崩溃是在渲染特定组件或执行特定功能时发生的,则可以尝试注释掉部分代码,并通过反复试验来找出有问题的代码。

I used both approaches. 我使用了两种方法。 The first one is easier, but it requires one-time integration work. 第一个比较容易,但是需要一次性集成工作。

If you use expo, you should use Sentry instead of Crashlytics. 如果使用expo,则应使用Sentry而不是Crashlytics。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 由于未捕获的异常“NSInvalidArgumentException”,iOS 上的 React Native 崩溃并终止应用程序 - React Native on iOS crashes with Terminating app due to uncaught exception 'NSInvalidArgumentException' React Native:由于 SoLoader 问题,应用程序在启动时崩溃 - React Native: App crashes on start due to SoLoader issue 如何找出反应本机应用程序中的内存泄漏? - How to find out memory leaks in react native app? 由于网络错误,React Native App崩溃 - React Native App crashes on Network error 如何修复 react-native-cli 无法安装应用程序错误? - How to fix the react-native-cli Failed to install the app error? 如何修复 Android Studio 中的 React Native 应用程序错误? - How to fix React Native app error in Android Studio? 如何修复反应原生的 memory 泄漏问题? - How to fix memory leak issue in react native? 导入某些组件模块时反应本机应用程序崩溃 - React native app crashes when some components module are being imported Android React Native上的(本机?)内存崩溃,报告的内存使用率较低 - Out of (native?) memory crashes on Android React Native, low reported memory usage 由于某些错误,React-Native Flatlist不是Rendring - React-Native Flatlist is not Rendring due to some error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM