software-mansion / react-native-screens

Native navigation primitives for your React Native app.
https://docs.swmansion.com/react-native-screens/
MIT License
3.11k stars 521 forks source link

Craslytics: Fatal Exception: java.lang.RuntimeException #408

Closed kperreau closed 4 years ago

kperreau commented 4 years ago

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

lucasluca commented 4 years ago

Same issue here

kperreau commented 4 years ago

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.

lucasluca commented 4 years ago

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

Jekiwijaya commented 4 years ago

I think this related to https://github.com/software-mansion/react-native-screens/issues/17#issuecomment-424704067

kperreau commented 4 years ago

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

Jekiwijaya commented 4 years ago

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

kperreau commented 4 years ago

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).

WoLewicki commented 4 years ago

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

kperreau commented 4 years ago

@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.

WoLewicki commented 4 years ago

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();.

docnbs commented 4 years ago

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 commented 4 years ago

@docnbs does this fix the issue: https://github.com/software-mansion/react-native-screens/issues/17#issuecomment-424704067?

docnbs commented 4 years ago

@WoLewicki Thanks for sharing. Will check and revert.

WoLewicki commented 4 years ago

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.

mi-mazouz commented 2 years ago

This issue still happen to my app even after passing null to onCreate function

camboYY commented 2 years ago

This issue still happen to my app even after passing null to onCreate function

jamninetyfive commented 2 years ago

This issue still happen to my app even after passing null to onCreate function

beqramo commented 2 years ago

me too, with null I have errors on different users, without null on different

subhadeepquantiantech commented 2 years ago

+1

QSuraj commented 2 years ago

+1

subhadeepquantiantech commented 2 years ago

For those who are facing issue while taking image from default camera. use react native camera vision instead.

webdiego commented 2 years ago

Same