Skip to content

Crash on app resume: The specified child already has a parent. #6201

Description

@abhayastudios

Not sure if related to #6199 (not using tabs), but I am having a serious issue where the app crashes after it comes back from being in the background: The specified child already has a parent. You must call removeView() on the child's parent first.

The full exception is below.

System.err: java.lang.RuntimeException: Unable to resume activity {com.abhayastudios.myapp/com.tns.NativeScriptActivity}: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
System.err:   at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3788)
System.err:   at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3828)
System.err:   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1746)
System.err:   at android.os.Handler.dispatchMessage(Handler.java:105)
System.err:   at android.os.Looper.loop(Looper.java:164)
System.err:   at android.app.ActivityThread.main(ActivityThread.java:6938)
System.err:   at java.lang.reflect.Method.invoke(Native Method)
System.err:   at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
System.err:   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
System.err: Caused by: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
System.err:   at android.view.ViewGroup.addViewInner(ViewGroup.java:5122)
System.err:   at android.view.ViewGroup.addView(ViewGroup.java:4953)
System.err:   at android.view.ViewGroup.addView(ViewGroup.java:4893)
System.err:   at android.view.ViewGroup.addView(ViewGroup.java:4866)
System.err:   at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1425)
System.err:   at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1750)
System.err:   at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1819)
System.err:   at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:797)
System.err:   at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2590)
System.err:   at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2377)
System.err:   at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2332)
System.err:   at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2239)
System.err:   at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:379)
System.err:   at android.support.v4.app.FragmentActivity.onResume(FragmentActivity.java:461)
System.err:   at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1361)
System.err:   at android.app.Activity.performResume(Activity.java:7353)
System.err:   at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3763)
System.err:   ... 8 more

Which platform(s) does your issue occur on?

Android

Please provide the following version numbers that your issue occurs with:

  • CLI: 4.2
  • Cross-platform modules: 4.3.0-2018-08-17-04
  • Runtime(s): 4.2
  • Plugin(s): (look for the version number in the package.json file of your
    project)

Please tell us how to recreate the issue in as much detail as possible.

Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions