question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ClassCastException: com.facebook.react.bridge.ReadableNativeMap cannot be cast to java.lang.String

See original GitHub issue

After migrating the project to AndroidX the app shows me this error at startup.

I have no clues about where to look for this error, I also tried to load an initial blank page to eliminate all the possible code written by me, but the problem persists.

This error only appears on Android (tested on Android 5.1 and 6.0), everything works correctly on iOS

React Native version: 0.59.10

E/unknown:ReactNative: Exception in native call
    java.lang.ClassCastException: com.facebook.react.bridge.ReadableNativeMap cannot be cast to java.lang.String
        at com.facebook.react.bridge.ReadableNativeArray.getString(ReadableNativeArray.java:135)
        at com.facebook.react.bridge.JavaMethodWrapper$5.extractArgument(JavaMethodWrapper.java:73)
        at com.facebook.react.bridge.JavaMethodWrapper$5.extractArgument(JavaMethodWrapper.java:69)
        at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:359)
        at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:158)
        at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
        at android.os.Handler.handleCallback(Handler.java:815)
        at android.os.Handler.dispatchMessage(Handler.java:104)
        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
        at android.os.Looper.loop(Looper.java:194)
        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:232)
        at java.lang.Thread.run(Thread.java:818)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
Ilario17commented, Sep 6, 2019

Hi @clementinoux after hours of testing I discovered that the error comes from an incompatible library, in my case the library is react-native-default-preference.

If I comment on the snippet in which I use this lib the error disappears

0reactions
stale[bot]commented, Dec 12, 2019

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

Read more comments on GitHub >

github_iconTop Results From Across the Web

com.facebook.react.bridge.readablenativemap cannot be cast ...
readableNativeArray cannot be cast to java.lang.boolean. And the issue was me passing a string instead of a boolean to a component.
Read more >
com.facebook.react.bridge.ReadableNativeMap cannot be ...
ReadableNativeMap cannot be cast to java.lang.string #28978 ... //Throws an error on any kind of argument //com.facebook.react.bridge.
Read more >
ReadableNativeMap cannot be cast to java.lang.String #851
Stacktrace from adb logcat. Exception in native call java.lang.ClassCastException: com.facebook.react.bridge.ReadableNativeMap cannot be cast to java.lang.
Read more >
[Android] com.facebook.react.bridge.ReadableNativeMap ...
[Android] com.facebook.react.bridge.ReadableNativeMap cannot be cast to java.lang.String.
Read more >
React native release apk crash upon start : r/reactnative - Reddit
ClassCastException : com.facebook.react.bridge.ReadableNativeMap cannot be cast to java.lang.String at com.facebook.react.bridge.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found