React-native-navigation: NavigationReactEventEmitter.sendEvent Error cause crash

Created on 4 Apr 2018  路  13Comments  路  Source: wix/react-native-navigation

Issue Description

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.reactnativenavigation.bridge.NavigationReactEventEmitter.sendEvent(java.lang.String, com.facebook.react.bridge.WritableMap)' on a null object reference
       at com.reactnativenavigation.bridge.EventEmitter.sendAppLaunchedEvent(EventEmitter.java:95)
       at com.reactnativenavigation.controllers.SplashActivity.onResume(SplashActivity.java:48)
       at org.consenlabs.imtoken.MainActivity.onResume(MainActivity.java:45)
       at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1266)
       at android.app.Activity.performResume(Activity.java:6446)
       at android.app.ActivityThread.performNewIntents(ActivityThread.java:2594)
       at android.app.ActivityThread.handleNewIntent(ActivityThread.java:2601)
       at android.app.ActivityThread.access$1700(ActivityThread.java:165)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1448)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:150)
       at android.app.ActivityThread.main(ActivityThread.java:5621)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684)

Steps to Reproduce / Code Snippets / Screenshots

launch app


Environment

  • React Native Navigation version: 1.1.365
  • React Native version: 0.51.0
  • Platform(s) : Android
  • Device info : Android 6.0.1 HUAWEI Release
馃彋 stale

All 13 comments

We also encounter another error, I'm not sure it's same as above or isn't.

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'com.facebook.react.bridge.JavaScriptModule com.facebook.react.bridge.ReactContext.getJSModule(java.lang.Class)' on a null object reference
       at com.reactnativenavigation.bridge.NavigationReactEventEmitter.<init>(NavigationReactEventEmitter.java:17)
       at com.reactnativenavigation.react.NavigationReactGateway.onReactContextInitialized(NavigationReactGateway.java:114)
       at com.reactnativenavigation.react.NavigationReactGateway.access$000(NavigationReactGateway.java:24)
       at com.reactnativenavigation.react.NavigationReactGateway$ReactNativeHostImpl.onReactContextInitialized(NavigationReactGateway.java:174)
       at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:1000)
       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:6665)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:781)

Environment
React Native Navigation version: 1.1.365
React Native version: 0.51.0
Platform(s) : Android
Device info: Android 7.1.1 / Android 8.0.0 XIAOMI Release

I'm having the same issue

java.lang.NullPointerException Attempt to invoke virtual method 'com.facebook.react.bridge.JavaScriptModule com.facebook.react.bridge.ReactContext.getJSModule(java.lang.Class)' on a null object reference 
    NavigationReactEventEmitter.java:17 com.reactnativenavigation.bridge.NavigationReactEventEmitter.<init>
    NavigationReactGateway.java:114 com.reactnativenavigation.react.NavigationReactGateway.onReactContextInitialized
    NavigationReactGateway.java:24 com.reactnativenavigation.react.NavigationReactGateway.access$000
    NavigationReactGateway.java:174 com.reactnativenavigation.react.NavigationReactGateway$ReactNativeHostImpl.onReactContextInitialized
    ReactInstanceManager.java:993 com.facebook.react.ReactInstanceManager$6.run
    Handler.java:739 android.os.Handler.handleCallback
    Handler.java:95 android.os.Handler.dispatchMessage
    Looper.java:148 android.os.Looper.loop
    ActivityThread.java:5585 android.app.ActivityThread.main
    Method.java:-2 java.lang.reflect.Method.invoke
    ZygoteInit.java:730 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
    ZygoteInit.java:620 com.android.internal.os.ZygoteInit.main

@SudoPlz https://github.com/wix/react-native-navigation/commit/085b3c9c901107c0da1b47dea6f042f43958b206 i'm not sure did this commit have solve this issue, maybe you could try it.

Good catch, I can try, but since I'm not able to reproduce at will, I'll have to wait and see if I receive any such crashes from our production apps.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest version and report back. Thank you for your contributions.

@stale i am also facing the same issue.
react-native-navigation : 1.1.344
react-native : 0.51.0
Platform(s) : Android version 7 / motorola mobile

Error log is as below

Fatal Exception: java.lang.RuntimeException: Unable to resume activity {com.CoolrSmartDevices/com.CoolrSmartDevices.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.reactnativenavigation.bridge.NavigationReactEventEmitter.sendEvent(java.lang.String, com.facebook.react.bridge.WritableMap)' on a null object reference
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3450)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3490)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2749)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1490)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6165)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778)

@SudoPlz
https://github.com/wix/react-native-navigation/commit/085b3c9c901107c0da1b47dea6f042f43958b206 seems haven't fixed this issue, we also have one hundred uses encounter this problem.
But now, I decided to upgrade our RNN version to 2.0, hope it will work excellently.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest version and report back. Thank you for your contributions.

The issue has been closed for inactivity.

@sapjax
Does upgrading the RNN version to 2.0 made this kind of issues go away?
Thanks!

Can anyone reproduce this error?

@rengil 2.0 still has many problems, so we had changed to react-navigation for several months.

This is still on issue on ^2.16.0". Can this be re-opened?

Was this page helpful?
0 / 5 - 0 ratings