question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

rn screens failed to find fragment for root react view

See original GitHub issue

Description

After performing a gradle clean rebuild, the Android version of the RN app does not work. It says failed to find fragment for root react view. iOS still works perfectly, and I’ve deleted node_modules, yarn.lock, cleared gradle cache and .idea/cache etc to no avail. It was working fine before the gradle clean, so I’m not sure what messed it up. Please advise.

here is my 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

Steps to reproduce

  1. I’m not sure how to repro, as iOS works fine and my repo is NDA. Please advise

Snack or a link to a repository

Not sure how to without violating NDA

Screens version

3.15

React Native version

0.68.1

Platforms

Android

JavaScript runtime

Hermes

Workflow

React Native (without Expo)

Architecture

Paper (Old Architecture)

Build type

Debug mode

Device

Real device

Device model

Samsung S9

Acknowledgements

Yes

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
kkafarcommented, Aug 22, 2022

@jrhager84! Check your yarn.lock. The code & methods present in stack trace you provided did not exist in react-native-screens@3.15.0. I bet you are on 3.16.0.

0reactions
jrhager84commented, Aug 22, 2022

I’m on 3.15 with react native 0.68.1 so I don’t think it’s related.

Read more comments on GitHub >

github_iconTop Results From Across the Web

'Failed to find fragment for React Root View ... - Stack Overflow
No information is available for this page.
Read more >
react-native-screens - npm
This project aims to expose native navigation container components to React Native. It is not designed to be used as a standalone library ......
Read more >
Native Stack Navigator | React Navigation
Native Stack Navigator provides a way for your app to transition between screens where each new screen is placed on top of a...
Read more >
Integration with Existing Apps - React Native
With a few steps, you can add new React Native based features, screens, views, etc. The specific steps are different depending on what ......
Read more >
How to pick images from Camera & Gallery in React Native app
Options that you get in React Native Image Picker are the following: Title; Cancel ButtonTitle; Take PhotoButtonTitle; Choose From Library ButtonTitle; Custom ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found