-
-
Notifications
You must be signed in to change notification settings - Fork 537
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
App crashing frequently because of this error #1481
Comments
Hey! 👋 It looks like you've omitted a few important sections from the issue template. Please complete Description and Reproduction sections. |
Hey! 👋 The issue doesn't seem to contain a minimal reproduction. Could you provide a snippet of code, a snack or a link to a GitHub repository that reproduces the problem? |
Already mentioned all the details, please look at it ASAP. |
Any update on this? I am having a lot of crashes because of this in prod. :( |
Can confirm that this is happening on RN 0.68.2 as well |
Same here, I add everything to. MainActivity |
Also affected by this on 0.68.2 with correct android MainActivity.java modifications. Again picked up through google play logs (happening often), but unable to reproduce exact steps. |
Did you follow the required steps from the main README file? See https://github.com/software-mansion/react-native-screens#android. |
Yes:
and then to the MainActivityDelegate class: @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(null);
} |
Seems weird that it happens after this change. It's hard to say anything definitive without a reproduction unfortunately. Is your stack trace the same @chvanlennep ? |
Looks like it:
|
same issue here, any workaround? |
It would be best if you could provide a repo with a reproduction of the issue so we could work on it, it is hard to say much without it unfortunately 😞 |
Hi! Do somebody knows the difference between using the line super.onCreate(savedInstanceState) instead of super.onCreate(null)? I can't find a clear explanation about it. |
this issue comments may help you. |
For our team, this issue is causing a 3% crash rate (the rate at which total sessions vs crashes per session exist) which is quite a large number for one package. It's possible that the quick fix Override worked before for previous years, but perhaps React Native, React Navigation, Android, or hardware itself has changed something which could mean changing the react-native-screens code to adapt. Our code follows the instructions as written to include the Override and the import android.os.bundle. This is happening on all versions of Android. I cannot give you an open source repo because our company does not disclose that. The app relies on react-navigation which relies on react-native-screens, otherwise I would just remove the package to solve the problem. This error/crash can be assumed to be happening before the JS is loaded in because it is not being detected inside our JS error reporting package (react-native-sentry), and is being reported only by the Play Store, indicating it's likely a native code issue. Here is the trace according to Play Store's data. Exception java.lang.RuntimeException: |
Ok, here's an idea I'll try that is not directly stated in the directions of the README. The Override call was added inside the public static class MainActivityDelegate extends ReactActivityDelegate {} function. If this is the difference in what fixes the issue, then please add the specific in the README to add it in the parent one that starts with public class MainActivity extends ReactActivity {} and not the other one. I'll report back after a while to see if this was my issue. If others have this placement as well or have already tried this placement, do comment on it. |
@evan1715 did it help? |
Giving more detail to where the override should be. ## Description Description and motivation for this PR. Helps users who are experiencing crashing from react-native-screens on Android who have placed the override in the wrong location. This modifies the readme for more clear instructions on what to do. When placed in the MainActivityDelegate, the crash still occurs, while placing it in the parent, it seems to be fine. Fixes #1481 . ## Test code and steps to reproduce N/A ## Checklist N/A Co-authored-by: Kacper Kafara <[email protected]>
hi! Should we replace super.onCreate(savedInstanceState) with super.onCreate(null), the problem will be solved. |
This is work for me |
My mainactivity.java doesn't look like this. Here is what it looks like:
Any tips? |
it's the same. place the override in the block of the class MainActivity and not nested further in the scope. same thing for when you go to the kotlin update. |
Thank you. Any ideas how to reproduce and verify before pushing to production? |
with "react-native": "0.74.1" and "react-native-screens": "3.31.1", I still get this error, in MainApplication.kt should i add null value to super.onCreate() function? |
as of RN 0.74.4 package com.yourcompany.yourappname
import android.os.Bundle //This line is for react-native-screens
import com.facebook.react.ReactActivity
import com.facebook.react.ReactActivityDelegate
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
import com.facebook.react.defaults.DefaultReactActivityDelegate
class MainActivity : ReactActivity() {
/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
override fun getMainComponentName(): String = "YourAppName"
/**
* Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
* which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
*/
override fun createReactActivityDelegate(): ReactActivityDelegate =
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
//react-native-screens override
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(null);
}
} |
Hi,
App is crashing frequently because of this error -
java.lang.IllegalStateException com.swmansion.rnscreens.ScreenFragment.
Steps To Reproduce
I don't have the exact steps to reproduce this error, but I can see the google playstore console logs.
Expected behavior
The app should not crash.
Actual behavior
App is crashing frequently
Platform
Android 9 (SDK 28)
Android 10 (SDK 29)
Workflow
Package versions
Google PlayStore Console Logs (Prod)
java.lang.RuntimeException: at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2991) at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3126) at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:78) at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:108) at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:68) at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1846) at android.os.Handler.dispatchMessage (Handler.java:106) at android.os.Looper.loop (Looper.java:201) at android.app.ActivityThread.main (ActivityThread.java:6882) at java.lang.reflect.Method.invoke (Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:547) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:873) Caused by: androidx.fragment.app.Fragment$InstantiationException: at androidx.fragment.app.Fragment.instantiate (Fragment.java:67) at androidx.fragment.app.FragmentContainer.instantiate (FragmentContainer.java) at androidx.fragment.app.FragmentManager$3.instantiate (FragmentManager.java:17) at androidx.fragment.app.FragmentStateManager.<init> (FragmentStateManager.java:15) at androidx.fragment.app.FragmentManager.restoreSaveState (FragmentManager.java:108) at androidx.fragment.app.FragmentController.restoreSaveState (FragmentController.java:8) at androidx.fragment.app.FragmentActivity$2.onContextAvailable (FragmentActivity.java:30) at androidx.activity.contextaware.ContextAwareHelper.dispatchOnContextAvailable (ContextAwareHelper.java:20) at androidx.activity.ComponentActivity.onCreate (ComponentActivity.java:7) at androidx.fragment.app.FragmentActivity.onCreate (FragmentActivity.java) at androidx.appcompat.app.AppCompatActivity.onCreate (AppCompatActivity.java:10) at com.facebook.react.ReactActivity.onCreate (ReactActivity.java) at com.nicestatus.MainActivity.onCreate (MainActivity.java:3) at android.app.Activity.performCreate (Activity.java:7232) at android.app.Activity.performCreate (Activity.java:7221) at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1272) at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2971) at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3126) at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:78) at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:108) at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:68) at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1846) at android.os.Handler.dispatchMessage (Handler.java:106) at android.os.Looper.loop (Looper.java:201) at android.app.ActivityThread.main (ActivityThread.java:6882) at java.lang.reflect.Method.invoke (Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:547) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:873) Caused by: java.lang.reflect.InvocationTargetException: at java.lang.reflect.Constructor.newInstance0 (Native Method) at java.lang.reflect.Constructor.newInstance (Constructor.java:343) at androidx.fragment.app.Fragment.instantiate (Fragment.java:21) at androidx.fragment.app.FragmentContainer.instantiate (FragmentContainer.java) at androidx.fragment.app.FragmentManager$3.instantiate (FragmentManager.java:17) at androidx.fragment.app.FragmentStateManager.<init> (FragmentStateManager.java:15) at androidx.fragment.app.FragmentManager.restoreSaveState (FragmentManager.java:108) at androidx.fragment.app.FragmentController.restoreSaveState (FragmentController.java:8) at androidx.fragment.app.FragmentActivity$2.onContextAvailable (FragmentActivity.java:30) at androidx.activity.contextaware.ContextAwareHelper.dispatchOnContextAvailable (ContextAwareHelper.java:20) at androidx.activity.ComponentActivity.onCreate (ComponentActivity.java:7) at androidx.fragment.app.FragmentActivity.onCreate (FragmentActivity.java) at androidx.appcompat.app.AppCompatActivity.onCreate (AppCompatActivity.java:10) at com.facebook.react.ReactActivity.onCreate (ReactActivity.java) at com.nicestatus.MainActivity.onCreate (MainActivity.java:3) at android.app.Activity.performCreate (Activity.java:7232) at android.app.Activity.performCreate (Activity.java:7221) at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1272) at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2971) at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3126) at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:78) at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:108) at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:68) at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1846) at android.os.Handler.dispatchMessage (Handler.java:106) at android.os.Looper.loop (Looper.java:201) at android.app.ActivityThread.main (ActivityThread.java:6882) at java.lang.reflect.Method.invoke (Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:547) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:873) Caused by: java.lang.IllegalStateException: at com.swmansion.rnscreens.ScreenFragment.<init> (ScreenFragment.java:23) at com.swmansion.rnscreens.ScreenStackFragment.<init> (ScreenStackFragment.java) at java.lang.reflect.Constructor.newInstance0 (Native Method) at java.lang.reflect.Constructor.newInstance (Constructor.java:343) at androidx.fragment.app.Fragment.instantiate (Fragment.java:21) at androidx.fragment.app.FragmentContainer.instantiate (FragmentContainer.java) at androidx.fragment.app.FragmentManager$3.instantiate (FragmentManager.java:17) at androidx.fragment.app.FragmentStateManager.<init> (FragmentStateManager.java:15) at androidx.fragment.app.FragmentManager.restoreSaveState (FragmentManager.java:108) at androidx.fragment.app.FragmentController.restoreSaveState (FragmentController.java:8) at androidx.fragment.app.FragmentActivity$2.onContextAvailable (FragmentActivity.java:30) at androidx.activity.contextaware.ContextAwareHelper.dispatchOnContextAvailable (ContextAwareHelper.java:20) at androidx.activity.ComponentActivity.onCreate (ComponentActivity.java:7) at androidx.fragment.app.FragmentActivity.onCreate (FragmentActivity.java) at androidx.appcompat.app.AppCompatActivity.onCreate (AppCompatActivity.java:10) at com.facebook.react.ReactActivity.onCreate (ReactActivity.java) at com.nicestatus.MainActivity.onCreate (MainActivity.java:3) at android.app.Activity.performCreate (Activity.java:7232) at android.app.Activity.performCreate (Activity.java:7221) at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1272) at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2971) at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3126) at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:78) at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:108) at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:68) at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1846) at android.os.Handler.dispatchMessage (Handler.java:106) at android.os.Looper.loop (Looper.java:201) at android.app.ActivityThread.main (ActivityThread.java:6882) at java.lang.reflect.Method.invoke (Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:547) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:873)
Please look into this error.
Thank you :)
The text was updated successfully, but these errors were encountered: