-
-
Notifications
You must be signed in to change notification settings - Fork 512
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
MainActivity getting destroyed intermittently / App is crashing while opening camera multiple times. #1816
Comments
Hey! 👋 The issue doesn't seem to contain a minimal reproduction. Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem? |
I too had the same issue and the same steps have to be followed in my case too. Followed the solutions provided in the following links but none of them are really solving my issue. We stopped a Production release because of this. Can someone please help us on this ? |
Hi @manishadp, thanks for the feedback! Could you provide us a link to the repository with code where the problem occurs, so we could reproduce the problem with provided steps? |
Unfortunately we work for an organisation and we are not allowed to share the code. Just adding some more info - This is basically happening when we are trying to open and close the camera repeatedly multiple times. |
Hi @tboba , It would be really grateful if you can respond faster as we are blocked from pushing the app to production. I found there is memory leaks, I'm adding screen shot. ScreenFragment and ScreenStackFragment I'm getting exception in both classes. Could you please check once. To reproduce the issue which i'm facing , you need to go to developer option and go to APPS and turn on Don't keep Activities
|
Hi @manishadp, Taking into account that a minimal reproducible example was not provided and we are not able to reproduce it on our side, we cannot prioritize your issue over other issues where such an example has been provided. As the library is open source, you can always try to fix the problem yourself (especially that you are able to reproduce it). Our libraries are maintained free of charge by a team with a limited number of people involved, but if you are not happy with the current pace of development and need premium support dedicated for your app, please reach out to us by sending an email to |
Description
For react-native screens, we tried with multiple versions, from 3.17.0 to 3.22.0, but in vain.
In super.onCreate, when we pass savedInstanceState as null (super.onCreate(null)) and open the camera multiple times ( Approximately 10-15 times), MainActivity is getting re-created and the app is re-launching.
If we pass super.onCreate(savedInstanceState) and do the same steps again then i'm getting below issue.
androidx.fragment.app.Fragment$InstantiationException: Unable to instantiate fragment com.swmansion.rnscreens.ScreenStackFragment: calling Fragment constructor caused an exception
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3834)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3980)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2394)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:211)
at android.os.Looper.loop(Looper.java:300)
at android.app.ActivityThread.main(ActivityThread.java:8296)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:559)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:954)
Caused by: androidx.fragment.app.Fragment$InstantiationException: Unable to instantiate fragment com.swmansion.rnscreens.ScreenStackFragment: calling Fragment constructor caused an exception
at androidx.fragment.app.Fragment.instantiate(Fragment.java:631)
at androidx.fragment.app.FragmentContainer.instantiate(FragmentContainer.java:57)
at androidx.fragment.app.FragmentManager$3.instantiate(FragmentManager.java:483)
at androidx.fragment.app.FragmentStateManager.(FragmentStateManager.java:85)
at androidx.fragment.app.FragmentManager.restoreSaveState(FragmentManager.java:2728)
at androidx.fragment.app.FragmentController.restoreSaveState(FragmentController.java:198)
at androidx.fragment.app.FragmentActivity$2.onContextAvailable(FragmentActivity.java:149)
at androidx.activity.contextaware.ContextAwareHelper.dispatchOnContextAvailable(ContextAwareHelper.java:99)
at androidx.activity.ComponentActivity.onCreate(ComponentActivity.java:362)
at androidx.fragment.app.FragmentActivity.onCreate(FragmentActivity.java:273)
at com.facebook.react.ReactActivity.onCreate(ReactActivity.java:45)
at com.adp.time.kiosk.MainActivity.onCreate(MainActivity.java:70)
at android.app.Activity.performCreate(Activity.java:8523)
at android.app.Activity.performCreate(Activity.java:8487)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1438)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3815)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3980)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2394)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:211)
at android.os.Looper.loop(Looper.java:300)
at android.app.ActivityThread.main(ActivityThread.java:8296)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:559)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:954)
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:613)
at androidx.fragment.app.FragmentContainer.instantiate(FragmentContainer.java:57)
at androidx.fragment.app.FragmentManager$3.instantiate(FragmentManager.java:483)
at androidx.fragment.app.FragmentStateManager.(FragmentStateManager.java:85)
at androidx.fragment.app.FragmentManager.restoreSaveState(FragmentManager.java:2728)
at androidx.fragment.app.FragmentController.restoreSaveState(FragmentController.java:198)
at androidx.fragment.app.FragmentActivity$2.onContextAvailable(FragmentActivity.java:149)
at androidx.activity.contextaware.ContextAwareHelper.dispatchOnContextAvailable(ContextAwareHelper.java:99)
at androidx.activity.ComponentActivity.onCreate(ComponentActivity.java:362)
at androidx.fragment.app.FragmentActivity.onCreate(FragmentActivity.java:273)
at com.facebook.react.ReactActivity.onCreate(ReactActivity.java:45)
at com.adp.time.kiosk.MainActivity.onCreate(MainActivity.java:70)
at android.app.Activity.performCreate(Activity.java:8523)
at android.app.Activity.performCreate(Activity.java:8487)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1438)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3815)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3980)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2394)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:211)
at android.os.Looper.loop(Looper.java:300)
at android.app.ActivityThread.main(ActivityThread.java:8296)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:559)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:954)
Caused by: java.lang.IllegalStateException: Screen fragments should never be restored. Follow instructions from #17 (comment) to properly configure your main activity.
Steps to reproduce
Snack or a link to a repository
https://stackoverflow.com/questions/57709742/unable-to-instantiate-fragment-com-swmansion-rnscreens-screen
Screens version
3.22.0
React Native version
0.70.6
Platforms
Android
JavaScript runtime
JSC
Workflow
None
Architecture
None
Build type
None
Device
Real device
Device model
All devices
Acknowledgements
Yes
The text was updated successfully, but these errors were encountered: