React-native-screens: Craslytics: Fatal Exception: java.lang.RuntimeException

Created on 7 Mar 2020  路  14Comments  路  Source: software-mansion/react-native-screens

Some of my users crash and i got this error on crashlytics.
It's random and not all the time.
It look like an internal error so if it can help i post the screen here.
Thank you.

Unable to start activity ComponentInfo{com.bereal.ft/com.bereal.ft.MainActivity}: androidx.fragment.app.Fragment$InstantiationException: Unable to instantiate fragment com.swmansion.rnscreens.ScreenStackFragment: could not find Fragment constructor

hht

bug

All 14 comments

Same issue here

And some times my users got a black screen and get stuck, they only can kill app and restart.

Hope it can help to solve it.

I removed react native screens from my app, because when this error happens, even the AsyncStorage database is cleaned

Not really a fix.
I tried this 2 weeks long, my users got a lot of crash when i put null in super.onCreate();.

I also face the same issue, I just tried to publish the onCreate(null) solution. Anyway, do you know how to repro the crash?

It's would be sad if must comment enableScreen() again, it improves a lot in android performances

Anyway, do you know how to repro the crash?

No idea.
When the app is killed, then receive a notification and open application from notification. But not sure at 100%.
Plus, it look like the app got a lot of crash with the Google TestLab (without notification, first install).

@kperreau is the crash the same as the one with not putting null in super.onCreate();?

@kperreau is the crash the same as the one with not putting null in super.onCreate();?

Yes i'm not putting null in super.onCreate();, it's worst if i put null, maybe cause i use react-native-splash-screen, i don't know.

I need it to be clear, if you put null in super.onCreate();, then the exception with Unable to instantiate fragment com.swmansion.rnscreens.ScreenStackFragment: could not find Fragment constructor still exist? Or does a different exception happen then? I am asking since I cannot recreate this exception when putting null in super.onCreate();.

Having the same issue. Please share if there is a proper fix. Sharing details if it helps.

  1. Fatal Exception: java.lang.RuntimeException
    Unable to start activity ComponentInfo{com.appname/com.appname.MainActivity}: androidx.fragment.app.Fragment$InstantiationException: Unable to instantiate fragment com.swmansion.rnscreens.ScreenFragment: calling Fragment constructor caused an exception

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.appname/com.appname.MainActivity}: androidx.fragment.app.Fragment$InstantiationException: Unable to instantiate fragment com.swmansion.rnscreens.ScreenFragment: calling Fragment constructor caused an exception
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2895)
at android.app.ActivityThread.-wrap11()
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1616)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:6651)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:824)

  1. Caused by androidx.fragment.app.Fragment$InstantiationException
    Unable to instantiate fragment com.swmansion.rnscreens.ScreenFragment: calling Fragment constructor caused an exception
    androidx.fragment.app.Fragment.instantiate

aused by java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Constructor.java)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at androidx.fragment.app.Fragment.instantiate(Fragment.java:548)
at androidx.fragment.app.FragmentContainer.instantiate(FragmentContainer.java:57)
at androidx.fragment.app.FragmentManager$3.instantiate(FragmentManager.java:390)
at androidx.fragment.app.FragmentStateManager.(FragmentStateManager.java:74)
at androidx.fragment.app.FragmentManager.restoreSaveState(FragmentManager.java:2454)
at androidx.fragment.app.FragmentController.restoreSaveState(FragmentController.java:196)
at androidx.fragment.app.FragmentActivity.onCreate(FragmentActivity.java:287)
at androidx.appcompat.app.AppCompatActivity.onCreate(AppCompatActivity.java:106)
at com.facebook.react.ReactActivity.onCreate(ReactActivity.java:51)
at com.appname.MainActivity.onCreate(MainActivity.java:16)
at android.app.Activity.performCreate(Activity.java:7088)
at android.app.Activity.performCreate(Activity.java:7079)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1215)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2895)
at android.app.ActivityThread.-wrap11()
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1616)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:6651)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:824)

@WoLewicki Thanks for sharing. Will check and revert.

From the stack trace, I see that all reported crashes are due to not applying null to the onCreate method. It is obligatory for the react-native-screens to work correctly. You can get more info here: https://github.com/software-mansion/react-native-screens/issues/17#issuecomment-425027574. I am closing this issue then. Feel free to comment if something is wrong.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

beetlebum picture beetlebum  路  5Comments

harrisrobin picture harrisrobin  路  3Comments

jeveloper picture jeveloper  路  5Comments

ukasiu picture ukasiu  路  4Comments

thomasgosse picture thomasgosse  路  4Comments