question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Android] Aplication crash when various navigate launched consecutively

See original GitHub issue

The crash occurs on a page with a navigation button that goes to a previous page using navigation.navigate, when hitting the button consecutively and continue producing touch events on the new loaded screen the application crashes.

This crash does not occur when the enableScreens is not activated.

Versions used react-native-screens : 2.0.0-alpha.29 @react-navigation/native: 5.0.0-alpha.27 @react-navigation/stack: 5.0.0-alpha.61

Java exception launched.

java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
    at android.view.ViewGroup.addViewInner(ViewGroup.java:3562)
    at android.view.ViewGroup.addView(ViewGroup.java:3415)
    at android.view.ViewGroup.addView(ViewGroup.java:3360)
    at android.view.ViewGroup.addView(ViewGroup.java:3336)
    at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:887)
    at androidx.fragment.app.FragmentManagerImpl.addAddedFragments(FragmentManagerImpl.java:2100)
    at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManagerImpl.java:1874)
    at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManagerImpl.java:1830)
    at androidx.fragment.app.FragmentManagerImpl.execPendingActions(FragmentManagerImpl.java:1727)
    at androidx.fragment.app.FragmentManagerImpl$2.run(FragmentManagerImpl.java:150)
    at android.os.Handler.handleCallback(Handler.java:733)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:136)
    at android.app.ActivityThread.main(ActivityThread.java:5001)
    at java.lang.reflect.Method.invokeNative(Method.java)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:752)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:586)
    at dalvik.system.NativeStart.main(NativeStart.java)

There is a workaround by disabling the button after the first call to the onPress event, but the crash can be still a problem and does not occur without enableScreens.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
nonewcodecommented, May 15, 2020

Hmm, i’ve tried starting a new project and setting listeners up for AppState and NetInfo. Can’t reproduce the issue so perhaps it’s something else that doesn’t play nicely. I’ll create a new issue if i end up reproducing it again.

It was definetly happening when i was asking for permissions based on connectivity / location change and then swapping from settings to application. I also swapped between stacks based on the outcome of the permissions check

1reaction
Kyberiuscommented, May 15, 2020

I apologize for the delayed response, for me the problem went away with an update to one of the stable versions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Crashes - Android Developers
An Android app crashes whenever there's an unexpected exit caused by an unhandled exception or signal. An app that is written using Java...
Read more >
How to Fix It When Apps Keep Crashing on Android - Lifewire
There are many common reasons an app may keep crashing on your Android. Try these fixes to solve this common problem.
Read more >
App Crashes whenever I click an Icon on Navigation bar
Just got many problems sorted out on my bottom navigation bar, but now the app crashes whenever I click on any of the...
Read more >
The Google App Is Repeatedly Crashing for Android Users ...
For this, navigate to Settings > Apps > Google on your Android device and tap on the Uninstall updates option.
Read more >
Why Do My Apps Keep Crashing on Android? Try these Fixes
In such conditions, when you try to launch the app again, it may freeze or crash. It is because the app wasn't closed...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found