Skip to content
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

The specified child already has a parent. You must call removeView() on the child's parent first. #309

Open
ziga-hvalec opened this issue Oct 21, 2024 · 10 comments
Assignees
Labels
priority: p0 Highest priority. Critical issue. P0 implies highest priority. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@ziga-hvalec
Copy link
Collaborator

ziga-hvalec commented Oct 21, 2024

We're getting this error occasionally java.lang.IllegalStateException - The specified child already has a parent. You must call removeView() on the child's parent first. Nav sdk 0.6.1 on android only

 Fatal Exception: com.google.android.libraries.navigation.internal.mq.b: ab{property=ab{propertyType=ARROW_PAGER_ITEMS, layout=com.google.android.libraries.navigation.internal.tx.k, view=com.google.android.libraries.geo.navcore.ui.header.views.SwipeableHeaderView{bef9379 V.E...... ......ID 0,0-720,278 #7f0902fe app:id/step_cue_header viewInfo = }, propertyValue=[com.google.android.libraries.navigation.internal.ts.a@c86d8be, com.google.android.libraries.navigation.internal.ts.a@c685d1f, com.google.android.libraries.navigation.internal.ts.a@9c9486c, com.google.android.libraries.navigation.internal.ts.a@e4cee35, com.google.android.libraries.navigation.internal.ts.a@953c2ca]}, viewModel=com.google.android.libraries.navigation.internal.ts.d@357b6ac}
       at android.view.ViewGroup.addViewInner(ViewGroup.java:5380)
       at android.view.ViewGroup.addView(ViewGroup.java:5201)
       at androidx.viewpager.widget.ViewPager.addView(ViewPager.java:1485)
       at android.view.ViewGroup.addView(ViewGroup.java:5136)
       at android.view.ViewGroup.addView(ViewGroup.java:5108)
       at com.google.android.libraries.navigation.internal.mo.b.instantiateItem(PG:7)
       at com.google.android.apps.gmm.base.views.viewpager.j.instantiateItem(PG:1)
       at androidx.viewpager.widget.ViewPager.addNewItem(ViewPager.java:1010)
       at androidx.viewpager.widget.ViewPager.populate(ViewPager.java:1158)
       at androidx.viewpager.widget.ViewPager.setCurrentItemInternal(ViewPager.java:669)
       at androidx.viewpager.widget.ViewPager.setCurrentItemInternal(ViewPager.java:631)
       at androidx.viewpager.widget.ViewPager.dataSetChanged(ViewPager.java:1086)
       at androidx.viewpager.widget.ViewPager$PagerObserver.onChanged(ViewPager.java:3097)
       at androidx.viewpager.widget.PagerAdapter.notifyDataSetChanged(PagerAdapter.java:291)
       at com.google.android.apps.gmm.base.views.viewpager.j.c(PG:6)
       at com.google.android.apps.gmm.base.views.viewpager.i.onChanged(PG:2)
       at android.database.DataSetObservable.notifyChanged(DataSetObservable.java:37)
       at androidx.viewpager.widget.PagerAdapter.notifyDataSetChanged(PagerAdapter.java:294)
       at com.google.android.libraries.navigation.internal.mo.b.b(PG:3)
       at com.google.android.apps.gmm.base.views.viewpager.g.a(PG:9)
       at com.google.android.libraries.navigation.internal.ms.a.g(PG:4)
       at com.google.android.libraries.navigation.internal.ms.c.b(PG:3)
       at com.google.android.libraries.navigation.internal.mn.bd.b(PG:3)
       at com.google.android.libraries.navigation.internal.mn.cc.r(PG:10)
       at com.google.android.libraries.navigation.internal.mn.cc.s(PG:13)
       at com.google.android.libraries.navigation.internal.mn.cc.r(PG:4)
       at com.google.android.libraries.navigation.internal.mn.cc.s(PG:13)
       at com.google.android.libraries.navigation.internal.mn.cc.r(PG:4)
       at com.google.android.libraries.navigation.internal.mn.cc.s(PG:13)
       at com.google.android.libraries.navigation.internal.mn.cc.r(PG:4)
       at com.google.android.libraries.navigation.internal.mn.cc.q(PG:3)
       at com.google.android.libraries.navigation.internal.mn.cc.m(PG:1)
       at com.google.android.libraries.navigation.internal.mn.cs.a(PG:6)
       at com.google.android.libraries.navigation.internal.mn.aj.invoke(:2)
       at com.google.android.libraries.navigation.internal.mn.am.a(PG:2)
       at com.google.android.libraries.navigation.internal.vm.cs.run(PG:1)
       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:487)
       at com.google.android.libraries.navigation.internal.if.b.run(PG:2)
       at android.os.Handler.handleCallback(Handler.java:958)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:257)
       at android.os.Looper.loop(Looper.java:368)
       at android.app.ActivityThread.main(ActivityThread.java:8839)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:572)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049)
        
          Caused by 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:5380)
       at android.view.ViewGroup.addView(ViewGroup.java:5201)
       at androidx.viewpager.widget.ViewPager.addView(ViewPager.java:1485)
       at android.view.ViewGroup.addView(ViewGroup.java:5136)
       at android.view.ViewGroup.addView(ViewGroup.java:5108)
       at com.google.android.libraries.navigation.internal.mo.b.instantiateItem(PG:7)
       at com.google.android.apps.gmm.base.views.viewpager.j.instantiateItem(PG:1)
       at androidx.viewpager.widget.ViewPager.addNewItem(ViewPager.java:1010)
       at androidx.viewpager.widget.ViewPager.populate(ViewPager.java:1158)
       at androidx.viewpager.widget.ViewPager.setCurrentItemInternal(ViewPager.java:669)
       at androidx.viewpager.widget.ViewPager.setCurrentItemInternal(ViewPager.java:631)
       at androidx.viewpager.widget.ViewPager.dataSetChanged(ViewPager.java:1086)
       at androidx.viewpager.widget.ViewPager$PagerObserver.onChanged(ViewPager.java:3097)
       at androidx.viewpager.widget.PagerAdapter.notifyDataSetChanged(PagerAdapter.java:291)
       at com.google.android.apps.gmm.base.views.viewpager.j.c(PG:6)
       at com.google.android.apps.gmm.base.views.viewpager.i.onChanged(PG:2)
       at android.database.DataSetObservable.notifyChanged(DataSetObservable.java:37)
       at androidx.viewpager.widget.PagerAdapter.notifyDataSetChanged(PagerAdapter.java:294)
       at com.google.android.libraries.navigation.internal.mo.b.b(PG:3)
       at com.google.android.apps.gmm.base.views.viewpager.g.a(PG:9)
       at com.google.android.libraries.navigation.internal.ms.a.g(PG:4)
       at com.google.android.libraries.navigation.internal.ms.c.b(PG:3)
       at com.google.android.libraries.navigation.internal.mn.bd.b(PG:3)
       at com.google.android.libraries.navigation.internal.mn.cc.r(PG:10)
       at com.google.android.libraries.navigation.internal.mn.cc.s(PG:13)
       at com.google.android.libraries.navigation.internal.mn.cc.r(PG:4)
       at com.google.android.libraries.navigation.internal.mn.cc.s(PG:13)
       at com.google.android.libraries.navigation.internal.mn.cc.r(PG:4)
       at com.google.android.libraries.navigation.internal.mn.cc.s(PG:13)
       at com.google.android.libraries.navigation.internal.mn.cc.r(PG:4)
       at com.google.android.libraries.navigation.internal.mn.cc.q(PG:3)
       at com.google.android.libraries.navigation.internal.mn.cc.m(PG:1)
       at com.google.android.libraries.navigation.internal.mn.cs.a(PG:6)
       at com.google.android.libraries.navigation.internal.mn.aj.invoke(:2)
       at com.google.android.libraries.navigation.internal.mn.am.a(PG:2)
       at com.google.android.libraries.navigation.internal.vm.cs.run(PG:1)
       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:487)
       at com.google.android.libraries.navigation.internal.if.b.run(PG:2)
       at android.os.Handler.handleCallback(Handler.java:958)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:257)
       at android.os.Looper.loop(Looper.java:368)
       at android.app.ActivityThread.main(ActivityThread.java:8839)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:572)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049)
        
@ziga-hvalec ziga-hvalec added triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Oct 21, 2024
@caio1985
Copy link
Contributor

Ack! @illuminati1911 can you please take a look into this? @jokerttu FYI.

@illuminati1911
Copy link
Contributor

@ziga-hvalec Thansk for reporting this!

Could you give use more detailed information about the issue?

  1. Do you get it completely randomly or does it happen in some specific situation?
  2. Are you getting this crash on Android emulator or real device?
  3. Which Android version are you using?

Also feel free to share any other information you think might be relevant.

@ziga-hvalec
Copy link
Collaborator Author

  1. I only saw this in crashlytics. Wasn't able to reproduce this.
  2. It is on a real android device.
  3. crashlytics says
    63% Android 14
    19% Android 12
    9% Android 13
    6% Android 10
    3% Other (1)

also doesn't seem to be device specific
47% Samsung
19% Oppo
9% Motorola
9% Vivo
16% Other (3)

@jokerttu jokerttu added the priority: p0 Highest priority. Critical issue. P0 implies highest priority. label Oct 23, 2024
@jokerttu
Copy link
Contributor

I’ve marked this as the highest priority. We need to find a way to reproduce the issue in order to identify a fix. This is an internal exception within the navigation SDK, but it’s most likely related to how views are initialized in the React Native package implementation.

@sr1k3sh
Copy link

sr1k3sh commented Nov 1, 2024

We're getting this error occasionally java.lang.IllegalStateException - The specified child already has a parent. You must call removeView() on the child's parent first. Nav sdk 0.6.1 on android only

 Fatal Exception: com.google.android.libraries.navigation.internal.mq.b: ab{property=ab{propertyType=ARROW_PAGER_ITEMS, layout=com.google.android.libraries.navigation.internal.tx.k, view=com.google.android.libraries.geo.navcore.ui.header.views.SwipeableHeaderView{bef9379 V.E...... ......ID 0,0-720,278 #7f0902fe app:id/step_cue_header viewInfo = }, propertyValue=[com.google.android.libraries.navigation.internal.ts.a@c86d8be, com.google.android.libraries.navigation.internal.ts.a@c685d1f, com.google.android.libraries.navigation.internal.ts.a@9c9486c, com.google.android.libraries.navigation.internal.ts.a@e4cee35, com.google.android.libraries.navigation.internal.ts.a@953c2ca]}, viewModel=com.google.android.libraries.navigation.internal.ts.d@357b6ac}
       at android.view.ViewGroup.addViewInner(ViewGroup.java:5380)
       at android.view.ViewGroup.addView(ViewGroup.java:5201)
       at androidx.viewpager.widget.ViewPager.addView(ViewPager.java:1485)
       at android.view.ViewGroup.addView(ViewGroup.java:5136)
       at android.view.ViewGroup.addView(ViewGroup.java:5108)
       at com.google.android.libraries.navigation.internal.mo.b.instantiateItem(PG:7)
       at com.google.android.apps.gmm.base.views.viewpager.j.instantiateItem(PG:1)
       at androidx.viewpager.widget.ViewPager.addNewItem(ViewPager.java:1010)
       at androidx.viewpager.widget.ViewPager.populate(ViewPager.java:1158)
       at androidx.viewpager.widget.ViewPager.setCurrentItemInternal(ViewPager.java:669)
       at androidx.viewpager.widget.ViewPager.setCurrentItemInternal(ViewPager.java:631)
       at androidx.viewpager.widget.ViewPager.dataSetChanged(ViewPager.java:1086)
       at androidx.viewpager.widget.ViewPager$PagerObserver.onChanged(ViewPager.java:3097)
       at androidx.viewpager.widget.PagerAdapter.notifyDataSetChanged(PagerAdapter.java:291)
       at com.google.android.apps.gmm.base.views.viewpager.j.c(PG:6)
       at com.google.android.apps.gmm.base.views.viewpager.i.onChanged(PG:2)
       at android.database.DataSetObservable.notifyChanged(DataSetObservable.java:37)
       at androidx.viewpager.widget.PagerAdapter.notifyDataSetChanged(PagerAdapter.java:294)
       at com.google.android.libraries.navigation.internal.mo.b.b(PG:3)
       at com.google.android.apps.gmm.base.views.viewpager.g.a(PG:9)
       at com.google.android.libraries.navigation.internal.ms.a.g(PG:4)
       at com.google.android.libraries.navigation.internal.ms.c.b(PG:3)
       at com.google.android.libraries.navigation.internal.mn.bd.b(PG:3)
       at com.google.android.libraries.navigation.internal.mn.cc.r(PG:10)
       at com.google.android.libraries.navigation.internal.mn.cc.s(PG:13)
       at com.google.android.libraries.navigation.internal.mn.cc.r(PG:4)
       at com.google.android.libraries.navigation.internal.mn.cc.s(PG:13)
       at com.google.android.libraries.navigation.internal.mn.cc.r(PG:4)
       at com.google.android.libraries.navigation.internal.mn.cc.s(PG:13)
       at com.google.android.libraries.navigation.internal.mn.cc.r(PG:4)
       at com.google.android.libraries.navigation.internal.mn.cc.q(PG:3)
       at com.google.android.libraries.navigation.internal.mn.cc.m(PG:1)
       at com.google.android.libraries.navigation.internal.mn.cs.a(PG:6)
       at com.google.android.libraries.navigation.internal.mn.aj.invoke(:2)
       at com.google.android.libraries.navigation.internal.mn.am.a(PG:2)
       at com.google.android.libraries.navigation.internal.vm.cs.run(PG:1)
       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:487)
       at com.google.android.libraries.navigation.internal.if.b.run(PG:2)
       at android.os.Handler.handleCallback(Handler.java:958)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:257)
       at android.os.Looper.loop(Looper.java:368)
       at android.app.ActivityThread.main(ActivityThread.java:8839)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:572)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049)
        
          Caused by 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:5380)
       at android.view.ViewGroup.addView(ViewGroup.java:5201)
       at androidx.viewpager.widget.ViewPager.addView(ViewPager.java:1485)
       at android.view.ViewGroup.addView(ViewGroup.java:5136)
       at android.view.ViewGroup.addView(ViewGroup.java:5108)
       at com.google.android.libraries.navigation.internal.mo.b.instantiateItem(PG:7)
       at com.google.android.apps.gmm.base.views.viewpager.j.instantiateItem(PG:1)
       at androidx.viewpager.widget.ViewPager.addNewItem(ViewPager.java:1010)
       at androidx.viewpager.widget.ViewPager.populate(ViewPager.java:1158)
       at androidx.viewpager.widget.ViewPager.setCurrentItemInternal(ViewPager.java:669)
       at androidx.viewpager.widget.ViewPager.setCurrentItemInternal(ViewPager.java:631)
       at androidx.viewpager.widget.ViewPager.dataSetChanged(ViewPager.java:1086)
       at androidx.viewpager.widget.ViewPager$PagerObserver.onChanged(ViewPager.java:3097)
       at androidx.viewpager.widget.PagerAdapter.notifyDataSetChanged(PagerAdapter.java:291)
       at com.google.android.apps.gmm.base.views.viewpager.j.c(PG:6)
       at com.google.android.apps.gmm.base.views.viewpager.i.onChanged(PG:2)
       at android.database.DataSetObservable.notifyChanged(DataSetObservable.java:37)
       at androidx.viewpager.widget.PagerAdapter.notifyDataSetChanged(PagerAdapter.java:294)
       at com.google.android.libraries.navigation.internal.mo.b.b(PG:3)
       at com.google.android.apps.gmm.base.views.viewpager.g.a(PG:9)
       at com.google.android.libraries.navigation.internal.ms.a.g(PG:4)
       at com.google.android.libraries.navigation.internal.ms.c.b(PG:3)
       at com.google.android.libraries.navigation.internal.mn.bd.b(PG:3)
       at com.google.android.libraries.navigation.internal.mn.cc.r(PG:10)
       at com.google.android.libraries.navigation.internal.mn.cc.s(PG:13)
       at com.google.android.libraries.navigation.internal.mn.cc.r(PG:4)
       at com.google.android.libraries.navigation.internal.mn.cc.s(PG:13)
       at com.google.android.libraries.navigation.internal.mn.cc.r(PG:4)
       at com.google.android.libraries.navigation.internal.mn.cc.s(PG:13)
       at com.google.android.libraries.navigation.internal.mn.cc.r(PG:4)
       at com.google.android.libraries.navigation.internal.mn.cc.q(PG:3)
       at com.google.android.libraries.navigation.internal.mn.cc.m(PG:1)
       at com.google.android.libraries.navigation.internal.mn.cs.a(PG:6)
       at com.google.android.libraries.navigation.internal.mn.aj.invoke(:2)
       at com.google.android.libraries.navigation.internal.mn.am.a(PG:2)
       at com.google.android.libraries.navigation.internal.vm.cs.run(PG:1)
       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:487)
       at com.google.android.libraries.navigation.internal.if.b.run(PG:2)
       at android.os.Handler.handleCallback(Handler.java:958)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:257)
       at android.os.Looper.loop(Looper.java:368)
       at android.app.ActivityThread.main(ActivityThread.java:8839)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:572)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049)
        

I'm also facing this issue. for me every time i close the view and reopen, i get mentioned issue Caused by: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. ... 46 more

@jokerttu jokerttu removed the triage me I really want to be triaged. label Nov 1, 2024
@ziga-hvalec
Copy link
Collaborator Author

Still happening on 0.8.1

@ziga-hvalec
Copy link
Collaborator Author

Has this been fixed. Any update on this?

@jokerttu
Copy link
Contributor

jokerttu commented Dec 4, 2024

@ziga-hvalec
I haven't been able to re-produce this. Could you please provide minimum example where this happens.

The error mentioned seems related to a view pager. Are you using a pager component? If so, could you specify which package you are using?

@jokerttu
Copy link
Contributor

@sr1k3sh
Same question for you, what view pager component you are using, could you provide example of the page hierarchy where this issue is visible.

@ziga-hvalec
Copy link
Collaborator Author

I'm not using any pager component. I do have react-native-pager-view installed because it's required by some other dependency, can't remember which tho.

"react-native-pager-view": "6.3.3",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p0 Highest priority. Critical issue. P0 implies highest priority. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

5 participants