react-native-reanimated icon indicating copy to clipboard operation
react-native-reanimated copied to clipboard

[Android] 2.8.0 - The specified child already has a parent

Open andreialecu opened this issue 2 years ago • 7 comments

Description

I found this logged on Sentry and it seems to mention a Reanimated stack trace.

Android 10, OnePlus model GM1925 (QKQ1.190716.003)

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:5131)
    at android.view.ViewGroup.addView(ViewGroup.java:4960)
    at com.facebook.react.views.view.ReactViewGroup.addView(ReactViewGroup.java:466)
    at android.view.ViewGroup.addView(ViewGroup.java:4900)
    at com.facebook.react.views.view.ReactClippingViewManager.addView(ReactClippingViewManager.java:38)
    at com.facebook.react.views.view.ReactClippingViewManager.addView(ReactClippingViewManager.java:19)
    at com.facebook.react.uimanager.NativeViewHierarchyManager.manageChildren(NativeViewHierarchyManager.java:533)
    at com.swmansion.reanimated.layoutReanimation.ReanimatedNativeHierarchyManager.manageChildren(ReanimatedNativeHierarchyManager.java:306)
    at com.facebook.react.uimanager.UIViewOperationQueue$ManageChildrenOperation.execute(UIViewOperationQueue.java:217)
    at com.facebook.react.uimanager.UIViewOperationQueue$1.run(UIViewOperationQueue.java:915)
    at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:1026)
    at com.facebook.react.uimanager.UIViewOperationQueue.access$2600(UIViewOperationQueue.java:47)
    at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:1086)
    at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:29)
    at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:175)
    at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:85)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1161)
    at android.view.Choreographer.doCallbacks(Choreographer.java:986)
    at android.view.Choreographer.doFrame(Choreographer.java:894)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1148)
    at android.os.Handler.handleCallback(Handler.java:883)
    at android.os.Handler.dispatchMessage(Handler.java:100)
    at android.os.Looper.loop(Looper.java:214)
    at android.app.ActivityThread.main(ActivityThread.java:7682)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)

Expected behavior

No crash.

Actual behavior & steps to reproduce

Native crash, not sure what the circumstances are. Just found it in Sentry.

Snack or minimal code example

Unknown.

Package versions

name version
react-native 0.68.1
react-native-reanimated 2.8.0

Affected platforms

  • [x] Android
  • [ ] iOS
  • [ ] Web

andreialecu avatar May 12 '22 09:05 andreialecu

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snippet of code, a snack or a link to a GitHub repository that reproduces the problem?

github-actions[bot] avatar May 12 '22 09:05 github-actions[bot]

Have similar issue, only stacktrace

Fatal Exception: 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:5247)
       at android.view.ViewGroup.addView(ViewGroup.java:5076)
       at com.facebook.react.views.view.ReactViewGroup.addView(ReactViewGroup.java:465)
       at android.view.ViewGroup.addView(ViewGroup.java:5016)
       at com.facebook.react.uimanager.ViewGroupManager.addView(ViewGroupManager.java:37)
       at com.facebook.react.uimanager.NativeViewHierarchyManager.manageChildren(NativeViewHierarchyManager.java:533)
       at com.swmansion.reanimated.layoutReanimation.ReanimatedNativeHierarchyManager.manageChildren(ReanimatedNativeHierarchyManager.java:306)
       at com.facebook.react.uimanager.UIViewOperationQueue$ManageChildrenOperation.execute(UIViewOperationQueue.java:217)
       at com.facebook.react.uimanager.UIViewOperationQueue$1.run(UIViewOperationQueue.java:915)
       at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:1026)
       at com.facebook.react.uimanager.UIViewOperationQueue.access$2600(UIViewOperationQueue.java:47)
       at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:1086)
       at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:29)
       at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:175)
       at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:85)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1035)
       at android.view.Choreographer.doCallbacks(Choreographer.java:845)
       at android.view.Choreographer.doFrame(Choreographer.java:775)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1022)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:201)
       at android.os.Looper.loop(Looper.java:288)
       at android.app.ActivityThread.main(ActivityThread.java:7870)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

wbinarytree avatar Jul 08 '22 07:07 wbinarytree

Same stack trace here, I can say that the device in question is also OnePlus. I can't reproduce it in the emulator (I know how the user triggers it). So might be brand specific? Not sure.

JoniVR avatar Jul 11 '22 17:07 JoniVR

I am actually experiencing this issue as well on production and emulator.

It happens only at app start though, I have to close the app the re-open it to reproduce.

Reloading / refreshing does not make the emulator crash.

robertwt7 avatar Jul 29 '22 05:07 robertwt7

I think this is also related to this: https://github.com/facebook/react-native/issues/27552

robertwt7 avatar Aug 01 '22 05:08 robertwt7

No updates on this? The library is basically unusable in the latest version of Expo sdk.

animaonline avatar Sep 09 '22 14:09 animaonline

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?

github-actions[bot] avatar Sep 09 '22 14:09 github-actions[bot]

@robertwt7 Were you able to find any solution or a possible work around for this issue? We are also facing same issue as you, happens once per launch/install on Android.

abitling avatar Mar 09 '23 21:03 abitling

We faced the same stack trace sometimes upon reloading the app. In our case, we are using wix's react-native-navigation library (v7.26.0)

Updating react-native-navigation to the latest version seems to fix it.

el-banna avatar Jul 05 '23 06:07 el-banna

I seem to be getting same issue on Android using [email protected]

Fatal Exception: 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:5958) at android.view.ViewGroup.addView(ViewGroup.java:5777) at com.facebook.react.views.view.ReactViewGroup.addView(ReactViewGroup.java:514) at android.view.ViewGroup.addView(ViewGroup.java:5717) at com.facebook.react.views.view.ReactClippingViewManager.addView(ReactClippingViewManager.java:38) at com.facebook.react.views.view.ReactClippingViewManager.addView(ReactClippingViewManager.java:19) at com.facebook.react.uimanager.NativeViewHierarchyManager.manageChildren(NativeViewHierarchyManager.java:533) at com.swmansion.reanimated.layoutReanimation.ReanimatedNativeHierarchyManager.manageChildren(ReanimatedNativeHierarchyManager.java:300) at com.facebook.react.uimanager.UIViewOperationQueue$ManageChildrenOperation.execute(UIViewOperationQueue.java:217) at com.facebook.react.uimanager.UIViewOperationQueue$1.run(UIViewOperationQueue.java:926) at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:1037) at com.facebook.react.uimanager.UIViewOperationQueue.-$$Nest$mflushPendingBatches() at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:1097) at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:29) at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:175) at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:85) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:994) at android.view.Choreographer.doCallbacks(Choreographer.java:794) at android.view.Choreographer.doFrame(Choreographer.java:725) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:981) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:237) at android.app.ActivityThread.main(ActivityThread.java:7814) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1068)

matasmaciulaitis avatar May 06 '24 13:05 matasmaciulaitis