better-rail / app

An alternative mobile client for Israel Railways
https://better-rail.co.il
GNU Affero General Public License v3.0
150 stars 27 forks source link

Fix Android crash: Unable to instantiate fragment #390

Closed guytepper closed 1 week ago

guytepper commented 1 week ago

Crashlytics started to report the following crash on Android devices:

Unable to instantiate fragment com.swmansion.rnscreens.ScreenStackFragment: calling Fragment constructor caused an exception

A thrown error has suggested this fix:

Screen fragments should never be restored. Follow instructions from https://github.com/software-mansion/react-native-screens/issues/17#issuecomment-424704067 to properly configure your main activity.

We had the MainActivity.java configured properly, but when migrating to Kotlin on the latest version (2.3.3), we forgot to add it to MainActivity.kt.