react-native: com.facebook.react.modules.core.ExceptionsManagerModule.reportException (ExceptionsManagerModule.java:79)

Description

Hi,

In Android the app randomly crashing with the below error. Got this in firebase crashlytics dashboard and there is no log to debug and reproduce. and We see this crash mostly happens on Samsung devices.

Fatal Exception: com.facebook.react.common.JavascriptException TypeError: null is not an object (evaluating ‘U.networkType.value’), stack: onValueChange@1368:4730 onPress@954:1602 onPress@229:1700 value@225:7540 value@225:6753 onResponderRelease@225:5556 b@99:1125 S@99:1268 w@99:1322 R@99:1617 M@99:2401 forEach@-1 U@99:2201 <unknown>@99:13818 Pe@99:90199 Re@99:13478 Ie@99:13664 receiveTouches@99:14448 value@40:3544 <unknown>@40:840 value@40:2798 value@40:812 value@-1

Below are the dependencies.

@burstware/react-native-portal”: “^1.0.2”, “@react-native-community/async-storage”: “^1.9.0”, “@react-native-community/datetimepicker”: “3.0.0”, “@react-native-community/geolocation”: “^2.0.2”, “@react-native-community/masked-view”: “^0.1.7”, “@react-native-community/netinfo”: “^5.9.5”, “@react-native-community/progress-bar-android”: “^1.0.3”, “@react-native-community/progress-view”: “@1.1.1”, “@react-native-firebase/analytics”: “^7.4.2”, “@react-native-firebase/app”: “^8.3.1”, “@react-native-firebase/crashlytics”: “^8.3.3”, “@react-navigation/bottom-tabs”: “5.2.6”, “@react-navigation/drawer”: “5.0.5”, “@react-navigation/material-bottom-tabs”: “5.1.7”, “@react-navigation/material-top-tabs”: “5.1.7”, “@react-navigation/native”: “5.1.4”, “@react-navigation/native-stack”: “5.0.5”, “@react-navigation/stack”: “5.2.9”, “android”: “^0.0.8”, “axios”: “^0.19.2”, “format-string-by-pattern”: “^1.2.1”, “jail-monkey”: “^2.3.2”, “jsc-android”: “^245459.0.0”, “moment”: “^2.24.0”, “patch-package”: “^6.4.7”, “prop-types”: “^15.7.2”, “react”: “16.11.0”, “react-native”: “0.62.1”, “react-native-add-calendar-event”: “3.0.2”, “react-native-awesome-card-io”: “^0.8.3”, “react-native-background-timer”: “^2.2.0”, “react-native-collapsible”: “^1.5.2”, “react-native-config”: “1.3.3”, “react-native-device-info”: “^5.6.1”, “react-native-document-picker”: “^4.1.0”, “react-native-easy-toast”: “^1.2.0”, “react-native-exit-app”: “^1.1.0”, “react-native-fs”: “2.16.6”, “react-native-gesture-handler”: “1.8.0”, “react-native-get-random-values”: “^1.4.0”, “react-native-htmlview”: “^0.15.0”, “react-native-image-base64”: “0.1.4”, “react-native-image-picker”: “2.3.1”, “react-native-image-resizer”: “1.2.3”, “react-native-image-zoom-viewer”: “3.0.1”, “react-native-in-app-review”: “^2.1.5”, “react-native-languages”: “^3.0.2”, “react-native-linear-gradient”: “^2.5.6”, “react-native-localization”: “^2.1.6”, “react-native-map-clustering”: “^3.3.4”, “react-native-maps”: “^0.27.1”, “react-native-modal”: “^11.5.6”, “react-native-orientation-locker”: “^1.0.21”, “react-native-pdf”: “^6.2.0”, “react-native-permissions”: “2.1.4”, “react-native-picker-select”: “^6.6.0”, “react-native-rate”: “^1.2.1”, “react-native-reanimated”: “^1.8.0”, “react-native-safe-area-context”: “^0.7.3”, “react-native-screens”: “@2.4.0”, “react-native-share”: “^5.1.0”, “react-native-signature-capture”: “^0.4.11”, “react-native-snap-carousel”: “^3.9.0”, “react-native-splash-screen”: “^3.2.0”, “react-native-sqlite-storage”: “https://github.com/leorajdsouza/react-native-sqlite-storage.git”, “react-native-svg”: “^12.1.0”, “react-native-tab-view”: “2.13.0”, “react-native-touch-id”: “^4.4.1”, “react-native-user-inactivity”: “^1.1.0”, “react-native-vector-icons”: “6.6.0”, “react-native-webview”: “~9.1.4”, “react-redux”: “^7.2.0”, “reanimated-bottom-sheet”: “^1.0.0-alpha.19”, “redux”: “^4.0.5”, “redux-logger”: “^3.0.6”, “redux-thunk”: “^2.3.0”, “rn-fetch-blob”: “^0.12.0”, “rn-secure-storage”: “^2.0.4”, “underscore”: “^1.12.0”

Any solution??

Version

0.62.1

Output of npx react-native info

No response

Steps to reproduce

Got it in Firebase Crashlytics.

Snack, code example, screenshot, or link to a repository

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 17
  • Comments: 121 (3 by maintainers)

Most upvoted comments

Same thing here. We are seeing crashes reported in the Play Store crashes & ANR console. This is all we get as the stack trace (I realize it might not be the same network error originally reported in this issue):

Title: com.facebook.react.modules.core.ExceptionsManagerModule.reportException Type: com.facebook.react.common.JavascriptException

Exception com.facebook.react.common.JavascriptException:
  at com.facebook.react.modules.core.ExceptionsManagerModule.reportException (ExceptionsManagerModule.java:72)
  at java.lang.reflect.Method.invoke
  at com.facebook.react.bridge.JavaMethodWrapper.invoke (JavaMethodWrapper.java:372)
  at com.facebook.react.bridge.JavaModuleWrapper.invoke (JavaModuleWrapper.java:188)
  at com.facebook.react.bridge.queue.NativeRunnable.run
  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:27)
  at android.os.Looper.loop (Looper.java:154)
  at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run (MessageQueueThreadImpl.java:226)
  at java.lang.Thread.run (Thread.java:762)

happening in Android 7, 10, 11 and 12

In my latest release, this crash is causing too frequently.

The following exception was only seen on Android 13 with SDK 33

Exception com.facebook.react.common.c:
 at com.facebook.react.modules.core.ExceptionsManagerModule.reportException (ExceptionsManagerModule.java:72)
 at java.lang.reflect.Method.invoke (Method.java)
 at com.facebook.react.bridge.JavaMethodWrapper.invoke (JavaMethodWrapper.java:372)
 at com.facebook.react.bridge.JavaModuleWrapper.invoke (JavaModuleWrapper.java:188)
 at com.facebook.react.bridge.queue.NativeRunnable.run (NativeRunnable.java)
 at android.os.Handler.handleCallback (Handler.java:942)
 at android.os.Handler.dispatchMessage (Handler.java:99)
 at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage (MessageQueueThreadHandler.java:27)
 at android.os.Looper.loopOnce (Looper.java:210)
 at android.os.Looper.loop (Looper.java:299)
 at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run (MessageQueueThreadImpl.java:226)
 at java.lang.Thread.run (Thread.java:1012)

Hello everyone, I notice that this problem is occurring and being reported by several users (I also have it).

Given the difficulty of reproduction, @dmytrorykun, wouldn’t it be a case to move some people to investigate the hypothesis that it really is related to a React glitch?

@Brunocolaco come on, check this!

I have the same issue but in getting deeper in the logs I found the actual error, which is unrelated to react native. If you have this I would recommend a better crash reporting lib or on the device to use adb get the logs and get the error.

My experience with this issue is that it’s either an uninitialized variable or function.

Firebase Test Lab can be helpful as it can randomly test different modules and screens with input that may be infrequent. Also, virtual devices seem to work better than real hardware, I think because they run slower and more erratically, so they can catch infrequent function calls, etc.

Also, Test Lab gives a better stack trace than Play Store. It will tell you what Class or Module the crash came from.

In my case, I wasn’t testing for non-initialization in componetWillUnmount. This is the corrected version. I think what was happening was that the elements were destroyed prior to the function being called.

componentWillUnmount() {
    this.unsubscribe();
    this.subscribe();
    if (Dimensions.removeEventListener && this.checkOrientation)
      Dimensions.removeEventListener("change", this.checkOrientation);
  }

The other thing is that I think, but am not sure, that you sometimes may be able to reproduce these bugs by changing the code while debugging, and see if it crashes. I used to think that the crashes were just artifacts of the debugging system, but I did notice that it was always crashing inside the above function. Moral of that story is that if you get crashes when updating code while debugging, it’s worth seeing if it’s a problem with your code.

I am also facing this issue - and just like you it happens in a way I can’t reproduce, however, this is a log am seeing in my diagnostics.

Same thing here. We are seeing crashes reported in the Play Store crashes & ANR console. This is all we get as the stack trace (I realize it might not be the same network error originally reported in this issue): Title: com.facebook.react.modules.core.ExceptionsManagerModule.reportException Type: com.facebook.react.common.JavascriptException

Exception com.facebook.react.common.JavascriptException:
  at com.facebook.react.modules.core.ExceptionsManagerModule.reportException (ExceptionsManagerModule.java:72)
  at java.lang.reflect.Method.invoke
  at com.facebook.react.bridge.JavaMethodWrapper.invoke (JavaMethodWrapper.java:372)
  at com.facebook.react.bridge.JavaModuleWrapper.invoke (JavaModuleWrapper.java:188)
  at com.facebook.react.bridge.queue.NativeRunnable.run
  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:27)
  at android.os.Looper.loop (Looper.java:154)
  at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run (MessageQueueThreadImpl.java:226)
  at java.lang.Thread.run (Thread.java:762)

happening in Android 7, 10, 11 and 12

conseguiu resolver?

As per my reply (#33916 (comment)) I think you’ll need to integrate some kind of Bug capture tool into your app. From my own research, I don’t think you’ll find any useful answers without integrating a meaningful bug/crash capture tool. I found Bugsnag very easy to implement but there are other out there - just google “react native bug crash capture”. Once I got a meaningful crash message, fixing my problems causing this error was very simple.

I completely agree with you. The description of failures and errors on the Google Play console is very truncated, here in general only the error call stack is described. I use Bugfender and with its help I found what the problem was (in my case it’s one of the libs I use).

image

just if it will help and give more context, will drop a picture from Google Console: image it looks most affected ones are Samsung devices

Same issue, happened on Android 11 (SDK 30)

Exception com.facebook.react.common.JavascriptException:
  at com.facebook.react.modules.core.ExceptionsManagerModule.reportException (ExceptionsManagerModule.java:72)
  at java.lang.reflect.Method.invoke
  at com.facebook.react.bridge.JavaMethodWrapper.invoke (JavaMethodWrapper.java:372)
  at com.facebook.react.bridge.JavaModuleWrapper.invoke (JavaModuleWrapper.java:188)
  at com.facebook.react.bridge.queue.NativeRunnable.run
  at android.os.Handler.handleCallback (Handler.java:938)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage (MessageQueueThreadHandler.java:27)
  at android.os.Looper.loop (Looper.java:246)
  at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run (MessageQueueThreadImpl.java:228)
  at java.lang.Thread.run (Thread.java:923)

Version:

  • react: 17.0.2
  • react-native: 0.68.2

Same problem for me, too (affected Android 10 and Android 12):

Exception com.facebook.react.common.JavascriptException:
  at com.facebook.react.modules.core.ExceptionsManagerModule.reportException (ExceptionsManagerModule.java:83)
  at java.lang.reflect.Method.invoke
  at com.facebook.react.bridge.JavaMethodWrapper.invoke (JavaMethodWrapper.java:372)
  at com.facebook.react.bridge.JavaModuleWrapper.invoke (JavaModuleWrapper.java:151)
  at com.facebook.react.bridge.queue.NativeRunnable.run
  at android.os.Handler.handleCallback (Handler.java:883)
  at android.os.Handler.dispatchMessage (Handler.java:100)
  at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage (MessageQueueThreadHandler.java:27)
  at android.os.Looper.loop (Looper.java:214)
  at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run (MessageQueueThreadImpl.java:226)
  at java.lang.Thread.run (Thread.java:919)

Kajanan02 - try adding in a bug catcher like Sentry (sentry.io) or Bugsnag (bugsnag.com) into your code to catch the details of the crash. That should tell you what’s going wrong

same here, 69% samsung :

`Fatal Exception: com.facebook.react.common.JavascriptException: TypeError: undefined is not a function, js engine: hermes, stack: onError@1798:1356 anonymous@794:5564 anonymous@795:565 anonymous@795:551 _e@30:93552 Ee@30:12998 anonymous@795:530 tryCallOne@53:15 anonymous@139:26 anonymous@78:1691 p@78:527 N@78:917 callReactNativeMicrotasks@78:3078 value@56:2934 anonymous@56:1044 value@56:2582 value@56:1003 value@56:938

   at com.facebook.react.modules.core.ExceptionsManagerModule.reportException(ExceptionsManagerModule.java:72)
   at java.lang.reflect.Method.invoke(Method.java)
   at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
   at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:188)
   at com.facebook.react.bridge.queue.NativeRunnable.run(NativeRunnable.java)
   at android.os.Handler.handleCallback(Handler.java:938)
   at android.os.Handler.dispatchMessage(Handler.java:99)
   at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
   at android.os.Looper.loop(Looper.java:246)
   at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:228)
   at java.lang.Thread.run(Thread.java:923)`

@herbertvuijk, Most likely you’ve tried to use a variable without initializing it. Play store doesn’t provide a very good stack trace for this type of thing. Firebase test lab is better. The default random test script works pretty well, and it gives you more detail about where the crash occurred.

Uninitialized variables are also pretty easy to find by just looking through your code or else writing something that can analyze your code to find them. I’ve been meaning to write one, but not yet.

Same issue here. Interesting to see that people are reporting this for more than a year and yet nothing happens.

My experience with this issue is that it’s either an uninitialized variable or function.

This agrees with what I’ve been seeing. For me these errors have been occurring when I try to use a Javascript method on an unititalised variable - e.g join() or trim()

We are impacted by the same issue as well, but not for all users. Affected device in the wild

image

I think it has to do with react-native-date-picker but I’m not able to reproduce it.

I am just thinking out loud - try resolving all non-fatals, it should disappear.

Someone was writing about disabling progourd, just found out that I was missing -keep class com.swmansion.reanimated.** { *; }(just found in reanimated docs, at first when I was doing it maybe they didn’t have it as I think I would add that line in proguard) from android proguard-rules.pro file, will monitor this change, and will update if it was a problem.

I solved the issue. In my case Platform component needed to be imported from react-native lib. I struggled for days and accidentally found the solution, so maybe look for components that weren’t imported since some phones don’t have them by default (S22 and S21 in my case 😅)

I’m having the same problem. And I can’t reproduce.

Not the best answer out here, but in my case I increased the target SDK and maximum SDK to 33 (latest).