13

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 5

6

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

Sign up to request clarification or add additional context in comments.

4 Comments

It says in the repo that 0.68.1 requires screens 3.14+
I'm using react-native 0.66.2 and latest version always have a problem of version mismatch.
So you're using 3.11?
yes I'm using 3.11.1
4

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

Comments

0

same issue with me, react native 69.4

1 Comment

Did you find a solution @hatajie for 69.4?
0

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.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.