-
-
Notifications
You must be signed in to change notification settings - Fork 510
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
[Android] Crash on killed app restore #114
Comments
Any luck guys with fixing this? (screens give really big boost the app but they crashing the app each time for the given scenario... ;() |
Any idea on how to solve/work-around this? I'm getting this error A LOT in my production build. Has anyone at least been able to find the line in this library that is causing the error? Here are my dependencies: "dependencies": {
"@react-native-community/async-storage": "^1.5.1",
"@react-native-community/netinfo": "^4.1.2",
"axios": "^0.19.0",
"color": "^3.1.2",
"formik": "^1.5.8",
"himalaya": "^1.1.0",
"qs": "^6.7.0",
"react": "16.8.6",
"react-native": "0.60.4",
"react-native-awesome-card-io": "^0.8.2",
"react-native-camera": "^3.0.0",
"react-native-code-push": "^5.6.1",
"react-native-fast-image": "^7.0.2",
"react-native-fbsdk": "git+https://github.com/facebook/react-native-fbsdk.git",
"react-native-gesture-handler": "^1.3.0",
"react-native-google-signin": "^2.0.0",
"react-native-reanimated": "^1.1.0",
"react-native-screens": "^1.0.0-alpha.23",
"react-native-sentry": "^0.43.2",
"react-native-webview": "^5.12.1",
"react-navigation": "^3.11.1",
"react-redux": "^7.1.0",
"redux": "^4.0.4",
"redux-thunk": "^2.3.0",
"styled-components": "^4.3.2",
"urbanairship-react-native": "^3.1.1",
"yup": "^0.27.0"
} |
If anyone else has this issue, I solved it by editing my public class MainActivity extends ReactActivity {
@Override
protected void onCreate(Bundle savedInstance) {
// super.onCreate(savedInstance);
super.onCreate(null);
}
} |
Similar problem here reported by the Google Play Store:
|
@douglasjunior I have the exact same error from the Google Play Console, how did you solve this problem? |
Hi @vikjovanov, sorry, I removed the react-native-screens from the projects until it became stable, I had a lot of crash problems so we decided not to insist for now. |
@douglasjunior Thank you for your answer, and do you feel a significant difference in performance or not? |
I always used "react-navigation" without this lib, I was just experimenting. The only difference you will have would be in apps that open a very large stack of screens. In the case of these apps you will have a RAM savings using "react-native-screens". |
@douglasjunior Ok ok ! Thanks a lot for your feedback, I'll think about it because I also have a lot of problems on Android with react-native-screens! |
I believe this issue should be resolved as of the latest version 2.0.0-beta.8. I can't tell for 100% because there was no repro scenario we could use to verify but fixes for few similar crashes have been applied since alpha.22. If you can still repro this on 2.0.0-beta.8 please provide a small repro app and start a new issue or comment here and I'll reopen. |
@kmagiera Did "react-native-screens" have any versions requirements for "react-native-reanimated" or "react-native-gesture-handler"? |
what do you mean by "version requirement". Those three packages are all disjoint and not directly depend on each other. There are some libraries that depend on some combination of these three but out of the box they are not coupled |
Hi @kmagiera, Issue.- com.facebook.react.ReactActivity.onCreate. |
I'm facing the issue again too (using 2.4.0). I don't believe a repo with a reproducible project is necessary in this case, as it's very simple to reproduce and most of the steps are done in the device, rather than in the code: On a physical device, go to Developer Options and enable the "Don't keep activities" option; then run your project (make sure you're calling The workaround I provided here still works |
I was on version |
This works for me but will this make any impact on the app ? removing the " // enableScreens();" also does the job, But I am not sure which one will be better and right solution. |
UPDATE I may have jumped the gun here... was debugging with the
|
@ALL In my case the app was crashing when I am rotating the screen. I had fixed this issue without compromising/disabling neither the app state nor the "enableScreens()". I just had to update my activity in manifest file like below.
Note: Keep in mind that this ill prevent your app from rerendering on screen orientation. But it works. |
Hi, I've tried to add these lines of code in MainActivity.java, and it works with developer option enabled-disabled scenario for me. In my case, after restoring from background and activities being kept it will preserve the state, otherwise, if the activities not kept it will show the splash screen again.
I don't know if it's nonsense, but it worked for me. Hope it helps someone. |
I have the same issue after upgrade to 3.3.0. Could someone reopen this issue? here the full stack trace:
|
This fix resolves the crash but as the activity is crashed in background, the app looses its state and gets stuck at the first screen. Navigation to further screens is blocked with this fix. |
This bug was fixed for me. When I downgraded to react-native-screens@^2.15.0 |
@kmagiera Still seeing this crash in Can we re-open that issue? The stack trace is:
|
Same issue. The stack trace is:
|
Hi, |
Hi, |
Hi, |
+1 |
still not working for me ... java.lang.RuntimeException:
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2977)
at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3114)
at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:113)
at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:71)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1859)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:201)
at android.app.ActivityThread.main (ActivityThread.java:6831)
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:927)
Caused by: androidx.fragment.app.Fragment$InstantiationException:
at androidx.fragment.app.Fragment.instantiate (Fragment.java:566)
at androidx.fragment.app.FragmentContainer.instantiate (FragmentContainer.java:57)
at androidx.fragment.app.FragmentManager$3.instantiate (FragmentManager.java:390)
at androidx.fragment.app.FragmentStateManager.<init> (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:44)
at android.app.Activity.performCreate (Activity.java:7224)
at android.app.Activity.performCreate (Activity.java:7213)
at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1271)
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2957)
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:548)
Caused by: java.lang.IllegalStateException:
at com.swmansion.rnscreens.ScreenFragment.<init> (ScreenFragment.java:46) |
I'm facing with the same problem.
When I open app in split view and resize window, then crash happen:
|
@omar-bear @mksoftware101 writing "same" on a 2-year-old issue isn't very helpful. Make sure you follow installation steps from README. If that doesn't solve the problem please open a new issue with proper description and reproduction. Cheers |
Hey, I am getting a crash on current version of this lib (^1.0.0-alpha.22)
2019-06-14 13:29:35.255 27866-27866/com.gelato.Optimalprint.dev E/AndroidRuntime: FATAL EXCEPTION: main Process: com.gelato.Optimalprint.dev, PID: 27866 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.gelato.Optimalprint.dev/com.gelato.Optimalprint.MainActivity}: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment com.swmansion.rnscreens.Screen$ScreenFragment: calling Fragment constructor caused an exception at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856) at android.app.ActivityThread.-wrap11(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) Caused by: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment com.swmansion.rnscreens.Screen$ScreenFragment: calling Fragment constructor caused an exception at android.support.v4.app.Fragment.instantiate(Fragment.java:465) at android.support.v4.app.FragmentContainer.instantiate(FragmentContainer.java:50) at android.support.v4.app.FragmentState.instantiate(FragmentState.java:80) at android.support.v4.app.FragmentManagerImpl.restoreAllState(FragmentManager.java:3109) at android.support.v4.app.FragmentController.restoreAllState(FragmentController.java:158) at android.support.v4.app.FragmentActivity.onCreate(FragmentActivity.java:344) at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:85) at com.facebook.react.ReactActivity.onCreate(ReactActivity.java:51) at android.app.Activity.performCreate(Activity.java:7009) at android.app.Activity.performCreate(Activity.java:7000) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856) at android.app.ActivityThread.-wrap11(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:334) at android.support.v4.app.Fragment.instantiate(Fragment.java:443) at android.support.v4.app.FragmentContainer.instantiate(FragmentContainer.java:50) at android.support.v4.app.FragmentState.instantiate(FragmentState.java:80) at android.support.v4.app.FragmentManagerImpl.restoreAllState(FragmentManager.java:3109) at android.support.v4.app.FragmentController.restoreAllState(FragmentController.java:158) at android.support.v4.app.FragmentActivity.onCreate(FragmentActivity.java:344) at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:85) at com.facebook.react.ReactActivity.onCreate(ReactActivity.java:51) at android.app.Activity.performCreate(Activity.java:7009) at android.app.Activity.performCreate(Activity.java:7000) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856) at android.app.ActivityThread.-wrap11(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) Caused by: java.lang.IllegalStateException: Screen fragments should never be restored at com.swmansion.rnscreens.Screen$ScreenFragment.<init>(Screen.java:23) at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:334) at android.support.v4.app.Fragment.instantiate(Fragment.java:443) at android.support.v4.app.FragmentContainer.instantiate(FragmentContainer.java:50) at android.support.v4.app.FragmentState.instantiate(FragmentState.java:80) at android.support.v4.app.FragmentManagerImpl.restoreAllState(FragmentManager.java:3109) at android.support.v4.app.FragmentController.restoreAllState(FragmentController.java:158) at android.support.v4.app.FragmentActivity.onCreate(FragmentActivity.java:344) at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:85) at com.facebook.react.ReactActivity.onCreate(ReactActivity.java:51) at android.app.Activity.performCreate(Activity.java:7009) at android.app.Activity.performCreate(Activity.java:7000) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856) at android.app.ActivityThread.-wrap11(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
I guess this is happening because of this code in ScreenFragment:
public ScreenFragment() { throw new IllegalStateException("Screen fragments should never be restored"); }
It will happen to users only when the activity is killed in the background and then user tries to restore it. It is easily reproducible by setting "Don't keep Activities" in Developer options.
The text was updated successfully, but these errors were encountered: