skip to Main Content

I had to rebuild my gradle for android, and now I’m getting an error with RNScreens.

Failed to find fragment for React Root View shows in the app.

Here is logcat:

2022-08-20 22:54:02.259 9195-9241/com.testApp.testApp E/WM-WorkerWrapper: Work [ id=b68c8532-e3ae-455d-9d84-a0a859f26e40, tags={ FOCUS_LOST_WORKER_TAG, com.onesignal.OSFocusHandler$OnLostFocusWorker } ] failed because it threw an exception/error
    java.util.concurrent.ExecutionException: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.pm.PackageManager android.content.Context.getPackageManager()' on a null object reference
        at androidx.work.impl.utils.futures.AbstractFuture.getDoneValue(AbstractFuture.java:516)
        at androidx.work.impl.utils.futures.AbstractFuture.get(AbstractFuture.java:475)
        at androidx.work.impl.WorkerWrapper$2.run(WorkerWrapper.java:311)
        at androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:91)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:919)
     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.pm.PackageManager android.content.Context.getPackageManager()' on a null object reference
        at com.onesignal.OSUtils.packageInstalledAndEnabled(OSUtils.java:275)
        at com.onesignal.OSUtils.isGMSInstalledAndEnabled(OSUtils.java:288)
        at com.onesignal.OSUtils.supportsGooglePush(OSUtils.java:330)
        at com.onesignal.OSUtils.getDeviceType(OSUtils.java:349)
        at com.onesignal.OSUtils.isAndroidDeviceType(OSUtils.java:371)
        at com.onesignal.LocationController.isGooglePlayServicesAvailable(LocationController.java:337)
        at com.onesignal.LocationController.onFocusChange(LocationController.java:325)
        at com.onesignal.OneSignal.onAppLostFocus(OneSignal.java:1352)
        at com.onesignal.OSFocusHandler$Companion.onLostFocusDoWork(OSFocusHandler.kt:139)
        at com.onesignal.OSFocusHandler$OnLostFocusWorker.doWork(OSFocusHandler.kt:118)
        at androidx.work.Worker$1.run(Worker.java:86)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:919) 
2022-08-20 22:54:02.661 9195-9195/com.testApp.testApp E/DecorView: mWindow.mActivityCurrentConfig is null
2022-08-20 22:54:03.303 9195-9300/com.testApp.testApp E/KeyStore: generateKeyInternal failed on request -68
2022-08-20 22:54:07.628 9195-9195/com.testApp.testApp E/ViewRootImpl: sendUserActionEvent() mView returned.
2022-08-20 22:54:08.061 9195-9195/com.testApp.testApp E/unknown:ReactNative: Exception in native call
    java.lang.IllegalStateException: Failed to find fragment for React Root View
        at com.swmansion.rnscreens.ScreenContainer.findFragmentManagerForReactRootView(ScreenContainer.kt:168)
        at com.swmansion.rnscreens.ScreenContainer.setupFragmentManager(ScreenContainer.kt:198)
        at com.swmansion.rnscreens.ScreenContainer.onAttachedToWindow(ScreenContainer.kt:228)
        at android.view.View.dispatchAttachedToWindow(View.java:21304)
        at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:4239)
        at android.view.ViewGroup.addViewInner(ViewGroup.java:6001)
        at android.view.ViewGroup.addView(ViewGroup.java:5777)
        at com.facebook.react.views.view.ReactViewGroup.addView(ReactViewGroup.java:466)
        at android.view.ViewGroup.addView(ViewGroup.java:5717)
        at com.facebook.react.uimanager.ViewGroupManager.addView(ViewGroupManager.java:37)
        at com.facebook.react.uimanager.NativeViewHierarchyManager.manageChildren(NativeViewHierarchyManager.java:533)
        at com.swmansion.reanimated.layoutReanimation.ReanimatedNativeHierarchyManager.manageChildren(ReanimatedNativeHierarchyManager.java:306)
        at com.facebook.react.uimanager.UIViewOperationQueue$ManageChildrenOperation.execute(UIViewOperationQueue.java:217)
        at com.facebook.react.uimanager.UIViewOperationQueue$1.run(UIViewOperationQueue.java:915)
        at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:1026)
        at com.facebook.react.uimanager.UIViewOperationQueue.access$2600(UIViewOperationQueue.java:47)
        at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:1086)
        at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:29)
        at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:175)
        at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:85)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:997)
        at android.view.Choreographer.doCallbacks(Choreographer.java:797)
        at android.view.Choreographer.doFrame(Choreographer.java:728)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:984)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:237)
        at android.app.ActivityThread.main(ActivityThread.java:8167)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
2022-08-20 22:54:08.198 9195-9195/com.testApp.testApp E/DecorView: mWindow.mActivityCurrentConfig is null

React Native 0.68.1
React native screens 3.15

5

Answers


  1. same issue with me, react native 69.4

    Login or Signup to reply.
  2. This issue occur in react-native-screens and new version react-native-screens is unstable.

    due to yarn install or npm install its upgrade react-native-screens.

    so remove caret symbol from your react-native-screens.

    "react-native-screens": "^3.11.1"
    to
    "react-native-screens": "3.11.1"
    and don’t allow your react-native-screens to upgarde

    then run yarn or npm i

    Login or Signup to reply.
  3. Here is working solution for react-native 0.66.4
    This issue is occur in react-native 0.66.4 as well. This is because of react-native-screens.

    Update your react-native-screen to 3.11.1 and remove the node_modules and reinstall it using yarn or npm i.

    Login or Signup to reply.
  4. Our app is using react-native 0.65.1 and we did the following:

    • update react-native-screens version from ^3.13.1 to 3.13.1 in package.json
    • remove yarn.lock file and node_modules folder
    • run yarn in terminal
    • run the app

    And now it’s working as expected. Hope this helps.

    Login or Signup to reply.
  5. This is a issue related to react-native-screen. they’ve just released a new version 3.17.0 which adds a fallback to the default behavior

    You just need to upgrade to version 3.17.0

    This is the PR for the fix: https://github.com/software-mansion/react-native-screens/pull/1566

    This is the release detail: https://github.com/software-mansion/react-native-screens/releases/tag/3.17.0

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search