title: 'Failed to find fragment for React Root View' React Native Android RNScreens
body: <p>I had to rebuild my gradle for android, and now I'm getting an error with RNScreens.</p>
  <p><code>Failed to find fragment for React Root View</code> shows in the app.</p>
  <p>Here is logcat:</p>
  <pre><code>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
  
  </code></pre>
  <p>React Native 0.68.1
  React native screens 3.15</p>