Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native Android error in com.facebook.react.bridge.NoSuchKeyException

I'm getting an error caught by Crashlytics and it's happening to almost 45% of the users but it doesn't seem to happen when the user is using the app but when it's in the background.

The stacktrace shown on Crashlytics is:

Fatal Exception: com.facebook.react.bridge.NoSuchKeyException ReadableNativeMap.java:124 lineNumber

I have no clue what can be causing this issue, if it's a Javascript error or a native library error

like image 781
Thiago Nascimento Avatar asked Apr 08 '19 14:04

Thiago Nascimento


2 Answers

This is a problem caused by the stacktrace-parser library which is used internally by react native. Basically, release 0.1.4 works fine while releases 0.1.5 and 0.1.6 causes the lineNumber error.

Do the following to fix this:

  1. If you are using yarn add the following to your package.json:
  "resolutions": {
    "stacktrace-parser": "0.1.4"
  },

if you are using npm add the following to your package.json:

"dependencies": {
    ...
    "stacktrace-parser": "0.1.4"
  1. Remove the yarn.lock (or package-lock.json) file and the node_modules directory.
  2. Install the packages yarn install (or npm install)
  3. Rebuild your release build.

I hope this helps others until the library gets fixed.

like image 174
Francois Nadeau Avatar answered Oct 21 '22 09:10

Francois Nadeau


My solution was to remove every console.error in my project.

https://github.com/facebook/react-native/issues/24382

like image 41
Jordan Daniels Avatar answered Oct 21 '22 10:10

Jordan Daniels