Skip to content

App Crash in Android 16 #1071

@mittalkamal29

Description

@mittalkamal29

java.lang.UnsupportedOperationException: ReactInstanceManager.createReactContext is unsupported. at com.facebook.react.ReactInstanceManager.(ReactInstanceManager.java:337) at com.facebook.react.ReactInstanceManagerBuilder.build(ReactInstanceManagerBuilder.kt:343) at com.facebook.react.ReactNativeHost.createReactInstanceManager(ReactNativeHost.java:97) at com.facebook.react.ReactNativeHost.getReactInstanceManager(ReactNativeHost.java:67) at com.wix.reactnativenotifications.fcm.FcmToken.sendTokenToJS(FcmToken.java:91) at com.wix.reactnativenotifications.fcm.FcmToken.lambda$refreshToken$0(FcmToken.java:86) at com.wix.reactnativenotifications.fcm.FcmToken.$r8$lambda$Os1hxRqWUHoSwUWJWk-vuSfZwmo(Unknown Source:0) at com.wix.reactnativenotifications.fcm.FcmToken$$ExternalSyntheticLambda0.onComplete(D8$$SyntheticClass:0) at com.google.android.gms.tasks.zzi.run(com.google.android.gms:play-services-tasks@@18.1.0:1) at android.os.Handler.handleCallback(Handler.java:995) at android.os.Handler.dispatchMessage(Handler.java:103) at android.os.Looper.loopOnce(Looper.java:248) at android.os.Looper.loop(Looper.java:338) at android.app.ActivityThread.main(ActivityThread.java:9067) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:593) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:932)

Important points:
ReactInstanceManager.createReactContext is unsupported
In React Native 0.82+, ReactInstanceManager.createReactContext is effectively disabled – calling it throws UnsupportedOperationException.

Crash is coming from Wix FCM code
com.wix.reactnativenotifications.fcm.FcmToken.sendTokenToJS is trying to send the FCM token to JS. The typical pattern in that library is:

Grab ReactInstanceManager from your ReactApplication

If getCurrentReactContext() is null, force creation of a React context (createReactContextInBackground / similar).

On RN 0.82+ / new architecture this “create React context on demand” path explodes with exactly this error.
Reddit
+1

Why it “works” on Android 15 but not 16

The crashing code is OS-agnostic, but when the FCM token refresh runs changes between OS versions
On Android 15 devices, the FCM token callback may only run after the app is fully started and React is already initialised, so getCurrentReactContext() isn’t null and it never tries to create a new context.

On Android 16, the token refresh hits earlier , reactContext is null, and the library tries to spin up a new React context → boom.

So: root cause = react-native-notifications not compatible with RN’s new architecture, not Android 16 itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions