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

Fatal Exception: java.lang.ArrayIndexOutOfBoundsException #3856

Closed
Willham12 opened this issue Dec 12, 2022 · 32 comments
Closed

Fatal Exception: java.lang.ArrayIndexOutOfBoundsException #3856

Willham12 opened this issue Dec 12, 2022 · 32 comments
Labels
Close when stale This issue is going to be closed when there is no activity for a while Missing repro This issue need minimum repro scenario Needs review Issue is ready to be reviewed by a maintainer Platform: Android This issue is specific to Android Unable to repro

Comments

@Willham12
Copy link

Willham12 commented Dec 12, 2022

Description

Fatal Exception: java.lang.ArrayIndexOutOfBoundsException: length=1; index=1
       at java.util.ArrayList.get(ArrayList.java:439)
       at com.swmansion.reanimated.NodesManager.onAnimationFrame(NodesManager.java:70)
       at com.swmansion.reanimated.NodesManager.access$000(NodesManager.java)
       at com.swmansion.reanimated.NodesManager$1.doFrameGuarded(NodesManager.java:2)
       at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java)
       at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:46)
       at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:2)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1106)
       at android.view.Choreographer.doCallbacks(Choreographer.java:866)
       at android.view.Choreographer.doFrame(Choreographer.java:792)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1092)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:226)
       at android.os.Looper.loop(Looper.java:313)
       at android.app.ActivityThread.main(ActivityThread.java:8751)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)

Steps to reproduce

idk

Snack or a link to a repository

https://snack.expo.dev/1234

Reanimated version

3.0.0-rc8

React Native version

0.70.5

Platforms

Android

JavaScript runtime

Hermes

Workflow

React Native (without Expo)

Architecture

Paper (Old Architecture)

Build type

Release mode

Device

Real device

Device model

No response

Acknowledgements

Yes

@Willham12 Willham12 added the Needs review Issue is ready to be reviewed by a maintainer label Dec 12, 2022
@github-actions github-actions bot added Repro provided A reproduction with a snippet of code, snack or repo is provided Platform: Android This issue is specific to Android labels Dec 12, 2022
@idlework
Copy link

idlework commented Dec 13, 2022

Got the same issue in my project. Since I added Reanimated to my project, I have been seeing crashes in my logs with indexOutOfBounds on Android. I have tried versions 2.12.0, 2.13.0 and 3.0.0-rc.8.

Fatal Exception: java.lang.IndexOutOfBoundsException
index=48 count=44 Index and count varies per crash.

android.view.ViewGroup.addInArray (ViewGroup.java:5606)
android.view.ViewGroup.addViewInner (ViewGroup.java:5499)
android.view.ViewGroup.addView (ViewGroup.java:5296)
com.facebook.react.views.view.ReactViewGroup.addView (ReactViewGroup.java:517)
android.view.ViewGroup.addView (ViewGroup.java:5236)
com.facebook.react.views.view.ReactClippingViewManager.addView (ReactClippingViewManager.java:38)
com.facebook.react.views.view.ReactClippingViewManager.addView (ReactClippingViewManager.java:19)
com.facebook.react.uimanager.NativeViewHierarchyManager.manageChildren (NativeViewHierarchyManager.java:533)
com.swmansion.reanimated.layoutReanimation.ReanimatedNativeHierarchyManager.manageChildren (ReanimatedNativeHierarchyManager.java:262)
com.facebook.react.uimanager.UIViewOperationQueue$ManageChildrenOperation.execute (UIViewOperationQueue.java:217)
com.facebook.react.uimanager.UIViewOperationQueue$1.run (UIViewOperationQueue.java:915)
com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches (UIViewOperationQueue.java:1026)
com.facebook.react.uimanager.UIViewOperationQueue.access$2600 (UIViewOperationQueue.java:47)
com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded (UIViewOperationQueue.java:1086)
com.facebook.react.uimanager.GuardedFrameCallback.doFrame (GuardedFrameCallback.java:29)
com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame (ReactChoreographer.java:175)
com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame (ChoreographerCompat.java:85)
android.view.Choreographer$CallbackRecord.run (Choreographer.java:1299)
android.view.Choreographer$CallbackRecord.run (Choreographer.java:1309)
android.view.Choreographer.doCallbacks (Choreographer.java:923)
android.view.Choreographer.doFrame (Choreographer.java:847)
android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:1283)
android.os.Handler.handleCallback (Handler.java:942)
android.os.Handler.dispatchMessage (Handler.java:99)
android.os.Looper.loopOnce (Looper.java:226)
android.os.Looper.loop (Looper.java:313)
android.app.ActivityThread.main (ActivityThread.java:8741)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:571)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1067)

@Bayramito
Copy link

same here

@piaskowyk
Copy link
Member

piaskowyk commented Jan 23, 2023

Hey, could someone provide a repo to reproduce this issue? Without repro, this is hard to fix :/

@palexs
Copy link

palexs commented Jan 27, 2023

We're also experiencing this crash. It seems to happen randomly.

@sebastianMagnaldi
Copy link

Hey i'm experiencing a very similar crash :

Exception java.lang.IndexOutOfBoundsException:
  at android.view.ViewGroup.removeViewsInternal (ViewGroup.java:6481)
  at android.view.ViewGroup.removeViewsInLayout (ViewGroup.java:6328)
  at com.facebook.react.views.view.ReactViewGroup.removeViewWithSubviewClippingEnabled (ReactViewGroup.java:614)
  at com.facebook.react.views.view.ReactClippingViewManager.removeViewAt (ReactClippingViewManager.java:72)
  at com.facebook.react.views.view.ReactClippingViewManager.removeViewAt (ReactClippingViewManager.java:19)
  at com.facebook.react.uimanager.ViewGroupManager.removeView (ViewGroupManager.java:82)
  at com.swmansion.reanimated.layoutReanimation.ReanimatedNativeHierarchyManager$1.run (ReanimatedNativeHierarchyManager.java:364)
  at com.swmansion.reanimated.layoutReanimation.ReanimatedNativeHierarchyManager.dropView (ReanimatedNativeHierarchyManager.java:404)
  at com.facebook.react.uimanager.NativeViewHierarchyManager.dropView (NativeViewHierarchyManager.java:646)
  at com.swmansion.reanimated.layoutReanimation.ReanimatedNativeHierarchyManager.dropView (ReanimatedNativeHierarchyManager.java:408)
  at com.facebook.react.uimanager.NativeViewHierarchyManager.dropView (NativeViewHierarchyManager.java:646)
  at com.swmansion.reanimated.layoutReanimation.ReanimatedNativeHierarchyManager.dropView (ReanimatedNativeHierarchyManager.java:408)
  at com.facebook.react.uimanager.NativeViewHierarchyManager.dropView (NativeViewHierarchyManager.java:646)
  at com.swmansion.reanimated.layoutReanimation.ReanimatedNativeHierarchyManager.dropView (ReanimatedNativeHierarchyManager.java:408)
  at com.facebook.react.uimanager.NativeViewHierarchyManager.dropView (NativeViewHierarchyManager.java:646)
  at com.swmansion.reanimated.layoutReanimation.ReanimatedNativeHierarchyManager.dropView (ReanimatedNativeHierarchyManager.java:408)
  at com.facebook.react.uimanager.NativeViewHierarchyManager.dropView (NativeViewHierarchyManager.java:646)
  at com.swmansion.reanimated.layoutReanimation.ReanimatedNativeHierarchyManager.dropView (ReanimatedNativeHierarchyManager.java:408)
  at com.facebook.react.uimanager.NativeViewHierarchyManager.dropView (NativeViewHierarchyManager.java:646)
  at com.swmansion.reanimated.layoutReanimation.ReanimatedNativeHierarchyManager.dropView (ReanimatedNativeHierarchyManager.java:408)
  at com.facebook.react.uimanager.NativeViewHierarchyManager$1.onAnimationEnd (NativeViewHierarchyManager.java:491)
  at com.swmansion.reanimated.layoutReanimation.ReaLayoutAnimator.lambda$deleteView$0 (ReanimatedNativeHierarchyManager.java:152)
  at com.swmansion.reanimated.layoutReanimation.ReaLayoutAnimator$$ExternalSyntheticLambda1.run
  at com.swmansion.reanimated.layoutReanimation.AnimationsManager.dfs (AnimationsManager.java:342)
  at com.swmansion.reanimated.layoutReanimation.AnimationsManager.removeLeftovers (AnimationsManager.java:251)
  at com.swmansion.reanimated.layoutReanimation.AnimationsManager.lambda$scheduleCleaning$0$com-swmansion-reanimated-layoutReanimation-AnimationsManager (AnimationsManager.java:294)
  at com.swmansion.reanimated.layoutReanimation.AnimationsManager$$ExternalSyntheticLambda0.run
  at android.os.Handler.handleCallback (Handler.java:938)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage (MessageQueueThreadHandler.java:27)
  at android.os.Looper.loop (Looper.java:246)
  at android.app.ActivityThread.main (ActivityThread.java:8625)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:602)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1130)

@kartikmittal1996
Copy link

kartikmittal1996 commented Feb 24, 2023

Same here, experiencing same crash -

Exception in native call
java.lang.IndexOutOfBoundsException: index=2 count=1
at android.view.ViewGroup.addInArray(ViewGroup.java:5376)
at android.view.ViewGroup.addViewInner(ViewGroup.java:5269)
at android.view.ViewGroup.addView(ViewGroup.java:5076)
at com.facebook.react.views.view.ReactViewGroup.addView(ReactViewGroup.java:517)
at android.view.ViewGroup.addView(ViewGroup.java:5016)
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: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:7839)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

@amerllica
Copy link

amerllica commented Mar 8, 2023

Any update?

reanimated version: 2.14.4

@kartikmittal1996
Copy link

Hey, not sure but I am not facing this issue anymore after I stop using LayoutAnimation.configreNext method to animate my header. I think that was experimental in Android so maybe creating issue with reanimated package.

@Willham12
Copy link
Author

Issue seems to be fixed with v3.

@pierroo
Copy link

pierroo commented Apr 3, 2023

Anyone else who was facing it can confirm v3 fixed it for them?
@amerllica ?

@Jscripter-pk
Copy link

@pierroo facing the same issue in android with v3 too.

@pierroo
Copy link

pierroo commented Apr 5, 2023

Thanks for sharing @Jscripter-pk , that's a bummer.
I finally migrated everything properly to use v3, only to find out it won't fix this one.
Considering v3 doesn't allow us to use useLegacyImplementation on react-navigation/drawer which will then lead to its own set of crashes, I am wondering whether or not it's actually worth migrating to v3?
Anyone saw any kind of improvement with it?

@Jscripter-pk
Copy link

@pierroo If you are going to production then I prefer not going with v3 for now. But if it is side project then it's ok

@pierroo
Copy link

pierroo commented Apr 14, 2023

Hey i'm experiencing a very similar crash :

Exception java.lang.IndexOutOfBoundsException:
  at android.view.ViewGroup.removeViewsInternal (ViewGroup.java:6481)
  at android.view.ViewGroup.removeViewsInLayout (ViewGroup.java:6328)
  at com.facebook.react.views.view.ReactViewGroup.removeViewWithSubviewClippingEnabled (ReactViewGroup.java:614)
  at com.facebook.react.views.view.ReactClippingViewManager.removeViewAt (ReactClippingViewManager.java:72)
  at com.facebook.react.views.view.ReactClippingViewManager.removeViewAt (ReactClippingViewManager.java:19)
  at com.facebook.react.uimanager.ViewGroupManager.removeView (ViewGroupManager.java:82)
  at com.swmansion.reanimated.layoutReanimation.ReanimatedNativeHierarchyManager$1.run (ReanimatedNativeHierarchyManager.java:364)
  at com.swmansion.reanimated.layoutReanimation.ReanimatedNativeHierarchyManager.dropView (ReanimatedNativeHierarchyManager.java:404)
  at com.facebook.react.uimanager.NativeViewHierarchyManager.dropView (NativeViewHierarchyManager.java:646)
  at com.swmansion.reanimated.layoutReanimation.ReanimatedNativeHierarchyManager.dropView (ReanimatedNativeHierarchyManager.java:408)
  at com.facebook.react.uimanager.NativeViewHierarchyManager.dropView (NativeViewHierarchyManager.java:646)
  at com.swmansion.reanimated.layoutReanimation.ReanimatedNativeHierarchyManager.dropView (ReanimatedNativeHierarchyManager.java:408)
  at com.facebook.react.uimanager.NativeViewHierarchyManager.dropView (NativeViewHierarchyManager.java:646)
  at com.swmansion.reanimated.layoutReanimation.ReanimatedNativeHierarchyManager.dropView (ReanimatedNativeHierarchyManager.java:408)
  at com.facebook.react.uimanager.NativeViewHierarchyManager.dropView (NativeViewHierarchyManager.java:646)
  at com.swmansion.reanimated.layoutReanimation.ReanimatedNativeHierarchyManager.dropView (ReanimatedNativeHierarchyManager.java:408)
  at com.facebook.react.uimanager.NativeViewHierarchyManager.dropView (NativeViewHierarchyManager.java:646)
  at com.swmansion.reanimated.layoutReanimation.ReanimatedNativeHierarchyManager.dropView (ReanimatedNativeHierarchyManager.java:408)
  at com.facebook.react.uimanager.NativeViewHierarchyManager.dropView (NativeViewHierarchyManager.java:646)
  at com.swmansion.reanimated.layoutReanimation.ReanimatedNativeHierarchyManager.dropView (ReanimatedNativeHierarchyManager.java:408)
  at com.facebook.react.uimanager.NativeViewHierarchyManager$1.onAnimationEnd (NativeViewHierarchyManager.java:491)
  at com.swmansion.reanimated.layoutReanimation.ReaLayoutAnimator.lambda$deleteView$0 (ReanimatedNativeHierarchyManager.java:152)
  at com.swmansion.reanimated.layoutReanimation.ReaLayoutAnimator$$ExternalSyntheticLambda1.run
  at com.swmansion.reanimated.layoutReanimation.AnimationsManager.dfs (AnimationsManager.java:342)
  at com.swmansion.reanimated.layoutReanimation.AnimationsManager.removeLeftovers (AnimationsManager.java:251)
  at com.swmansion.reanimated.layoutReanimation.AnimationsManager.lambda$scheduleCleaning$0$com-swmansion-reanimated-layoutReanimation-AnimationsManager (AnimationsManager.java:294)
  at com.swmansion.reanimated.layoutReanimation.AnimationsManager$$ExternalSyntheticLambda0.run
  at android.os.Handler.handleCallback (Handler.java:938)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage (MessageQueueThreadHandler.java:27)
  at android.os.Looper.loop (Looper.java:246)
  at android.app.ActivityThread.main (ActivityThread.java:8625)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:602)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1130)

I just realized that my error crashes are exactly the same as yours @sebastianMagnaldi ; with the " at android.view.ViewGroup.removeViewsInternal"
Were you able to find a fix by any chance?

@atn4z7
Copy link

atn4z7 commented Apr 22, 2023

still experiencing this with v3 unfortunately

@ohheyitskartik
Copy link

Hey i'm experiencing a very similar crash :

Exception java.lang.IndexOutOfBoundsException:
  at android.view.ViewGroup.removeViewsInternal (ViewGroup.java:6481)
  at android.view.ViewGroup.removeViewsInLayout (ViewGroup.java:6328)
  at com.facebook.react.views.view.ReactViewGroup.removeViewWithSubviewClippingEnabled (ReactViewGroup.java:614)
  at com.facebook.react.views.view.ReactClippingViewManager.removeViewAt (ReactClippingViewManager.java:72)
  at com.facebook.react.views.view.ReactClippingViewManager.removeViewAt (ReactClippingViewManager.java:19)
  at com.facebook.react.uimanager.ViewGroupManager.removeView (ViewGroupManager.java:82)
  at com.swmansion.reanimated.layoutReanimation.ReanimatedNativeHierarchyManager$1.run (ReanimatedNativeHierarchyManager.java:364)
  at com.swmansion.reanimated.layoutReanimation.ReanimatedNativeHierarchyManager.dropView (ReanimatedNativeHierarchyManager.java:404)
  at com.facebook.react.uimanager.NativeViewHierarchyManager.dropView (NativeViewHierarchyManager.java:646)
  at com.swmansion.reanimated.layoutReanimation.ReanimatedNativeHierarchyManager.dropView (ReanimatedNativeHierarchyManager.java:408)
  at com.facebook.react.uimanager.NativeViewHierarchyManager.dropView (NativeViewHierarchyManager.java:646)
  at com.swmansion.reanimated.layoutReanimation.ReanimatedNativeHierarchyManager.dropView (ReanimatedNativeHierarchyManager.java:408)
  at com.facebook.react.uimanager.NativeViewHierarchyManager.dropView (NativeViewHierarchyManager.java:646)
  at com.swmansion.reanimated.layoutReanimation.ReanimatedNativeHierarchyManager.dropView (ReanimatedNativeHierarchyManager.java:408)
  at com.facebook.react.uimanager.NativeViewHierarchyManager.dropView (NativeViewHierarchyManager.java:646)
  at com.swmansion.reanimated.layoutReanimation.ReanimatedNativeHierarchyManager.dropView (ReanimatedNativeHierarchyManager.java:408)
  at com.facebook.react.uimanager.NativeViewHierarchyManager.dropView (NativeViewHierarchyManager.java:646)
  at com.swmansion.reanimated.layoutReanimation.ReanimatedNativeHierarchyManager.dropView (ReanimatedNativeHierarchyManager.java:408)
  at com.facebook.react.uimanager.NativeViewHierarchyManager.dropView (NativeViewHierarchyManager.java:646)
  at com.swmansion.reanimated.layoutReanimation.ReanimatedNativeHierarchyManager.dropView (ReanimatedNativeHierarchyManager.java:408)
  at com.facebook.react.uimanager.NativeViewHierarchyManager$1.onAnimationEnd (NativeViewHierarchyManager.java:491)
  at com.swmansion.reanimated.layoutReanimation.ReaLayoutAnimator.lambda$deleteView$0 (ReanimatedNativeHierarchyManager.java:152)
  at com.swmansion.reanimated.layoutReanimation.ReaLayoutAnimator$$ExternalSyntheticLambda1.run
  at com.swmansion.reanimated.layoutReanimation.AnimationsManager.dfs (AnimationsManager.java:342)
  at com.swmansion.reanimated.layoutReanimation.AnimationsManager.removeLeftovers (AnimationsManager.java:251)
  at com.swmansion.reanimated.layoutReanimation.AnimationsManager.lambda$scheduleCleaning$0$com-swmansion-reanimated-layoutReanimation-AnimationsManager (AnimationsManager.java:294)
  at com.swmansion.reanimated.layoutReanimation.AnimationsManager$$ExternalSyntheticLambda0.run
  at android.os.Handler.handleCallback (Handler.java:938)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage (MessageQueueThreadHandler.java:27)
  at android.os.Looper.loop (Looper.java:246)
  at android.app.ActivityThread.main (ActivityThread.java:8625)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:602)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1130)

I just realized that my error crashes are exactly the same as yours @sebastianMagnaldi ; with the " at android.view.ViewGroup.removeViewsInternal" Were you able to find a fix by any chance?

i have a similar issue, same crash log, experiencing this on 2.3.1

@ohheyitskartik
Copy link

Can we reopen @Willham12 ? Since v3 is still facing the issue as mentioned by @Jscripter-pk

@Willham12 Willham12 reopened this Jun 12, 2023
@sn4f
Copy link

sn4f commented Jul 22, 2023

Same issue :/

@gabrielfurini
Copy link

gabrielfurini commented Aug 1, 2023

Same issue here with 3.3.0 in Android after upgrading to Expo SDK 49. iOS is ok.
I couldn't notice any pattern. Seems to happen randomly. 😢

@gabrielfurini
Copy link

I could find a way out of these crashes.
Somehow they were happening because some entering and exiting animations while navigating through screens. Simply removed them and no more crashes for now.

@normenster
Copy link

Same issue here with 3.3.0 and RN 0.72 and Expo SDK. It happenes only in the wild, never appeared in our testruns or in browserstack. I have removed all entering and exiting Animations and also the call to the old LayoutAnimation.configureNext which i was still using. I also had one useAnimationProps animation that was triggered after a setTimeout on screen render. Maybe this setTimeout was causing issues when navigating between screens. I will give an update if the crashes are going down with the applied fixes.

@tamirla
Copy link

tamirla commented Oct 5, 2023

any update on that issue ?

we're also experiencing ArrayIndexOutOfBoundsException with version 2.14.4, although our stack trace looks different:

com.facebook.react.bridge.ReadableNativeMap in importValues
com.facebook.react.bridge.ReadableNativeMap in getLocalMap at line 52
com.facebook.react.bridge.ReadableNativeMap in hasKey at line 95
com.facebook.react.bridge.ReadableNativeMap in getNullableValue at line 120
com.facebook.react.bridge.ReadableNativeMap in getNullableValue at line 127
com.facebook.react.bridge.ReadableNativeMap in getString at line 162
com.swmansion.reanimated.NodesManager in createNode at line 335
com.swmansion.reanimated.ReanimatedModule$2 in execute at line 129
com.swmansion.reanimated.ReanimatedModule$1 in execute at line 83
com.facebook.react.uimanager.UIViewOperationQueue$UIBlockOperation in execute at line 579
com.facebook.react.uimanager.UIViewOperationQueue$1 in run at line 915
com.facebook.react.uimanager.UIViewOperationQueue in flushPendingBatches at line 1026
com.facebook.react.uimanager.UIViewOperationQueue in access$2600 at line 47
com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback in doFrameGuarded at line 1086
com.facebook.react.uimanager.GuardedFrameCallback in doFrame at line 29
com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher in doFrame at line 175
com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1 in doFrame at line 85
android.view.Choreographer$CallbackRecord in run at line 1299
android.view.Choreographer$CallbackRecord in run at line 1309
android.view.Choreographer in doCallbacks at line 923
android.view.Choreographer in doFrame at line 847
android.view.Choreographer$FrameDisplayEventReceiver in run at line 1283
android.os.Handler in handleCallback at line 942
android.os.Handler in dispatchMessage at line 99
android.os.Looper in loopOnce at line 226
android.os.Looper in loop at line 313
android.app.ActivityThread in main at line 8762
java.lang.reflect.Method in invoke
com.android.internal.os.RuntimeInit$MethodAndArgsCaller in run at line 604
com.android.internal.os.ZygoteInit in main at line 1067

We have multiple error messages for this exception, such as:

  • couldn't find key type in dynamic object
  • couldn't find key positioP in dynamic object
  • couldn't find key fontSize in dynamic object
  • couldn't find key allowFontScalin in dynamic object

In addition we have another crash with the following stack trace, not sure if it's related:

JSApplicationIllegalArgumentException Unsupported node type: null

com.swmansion.reanimated.NodesManager in createNode at line 380
com.swmansion.reanimated.ReanimatedModule$2 in execute at line 129
com.swmansion.reanimated.ReanimatedModule$1 in execute at line 83
com.facebook.react.uimanager.UIViewOperationQueue$UIBlockOperation in execute at line 579
com.facebook.react.uimanager.UIViewOperationQueue$1 in run at line 915
com.facebook.react.uimanager.UIViewOperationQueue in flushPendingBatches at line 1026
com.facebook.react.uimanager.UIViewOperationQueue in access$2600 at line 47
com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback in doFrameGuarded at line 1086
com.facebook.react.uimanager.GuardedFrameCallback in doFrame at line 29
com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher in doFrame at line 175
com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1 in doFrame at line 85
android.view.Choreographer$CallbackRecord in run at line 1319
android.view.Choreographer$CallbackRecord in run at line 1329
android.view.Choreographer in doCallbacks at line 930
android.view.Choreographer in doFrame at line 854
android.view.Choreographer$FrameDisplayEventReceiver in run at line 1303
android.os.Handler in handleCallback at line 942
android.os.Handler in dispatchMessage at line 99
android.os.Looper in loopOnce at line 226
android.os.Looper in loop at line 313
android.app.ActivityThread in main at line 8805
java.lang.reflect.Method in invoke
com.android.internal.os.RuntimeInit$MethodAndArgsCaller in run at line 604
com.android.internal.os.ZygoteInit in main at line 1067

I didn't find any reference to this other crash.

we started to see these crashes more frequently after upgrading @sentry/react-native in order to solve frequent native crashes related to latest android update, that are still under investigation by Sentry:

facebook/react-native#39505
getsentry/sentry-java#2955

I don't see how this could be related, but there wasn't any other significant change between our versions.

I should also mention that we don't use this library explicitly anywhere in our code, it is used only by react-navigation.

Can someone confirm that upgrading to any specific version (2.* or 3.*) fixed the issue ?

@Latropos Latropos added Missing repro This issue need minimum repro scenario and removed Repro provided A reproduction with a snippet of code, snack or repo is provided labels Nov 15, 2023
@Latropos Latropos added Unable to repro Close when stale This issue is going to be closed when there is no activity for a while labels Nov 15, 2023
@github-actions github-actions bot closed this as completed Dec 5, 2023
@aneena-thomas
Copy link

Still getting crash

react-native-reanimated: "^3.7.1",

Fatal Exception: java.lang.IndexOutOfBoundsException
index=1 count=0
android.view.ViewGroup.addInArray (ViewGroup.java:5297)
android.view.ViewGroup.addViewInner (ViewGroup.java:5190)
android.view.ViewGroup.addView (ViewGroup.java:4997)
android.view.ViewGroup.addView (ViewGroup.java:4937)
com.facebook.react.uimanager.ViewGroupManager.addView (ViewGroupManager.java:38)
com.facebook.react.uimanager.NativeViewHierarchyManager.manageChildren (NativeViewHierarchyManager.java:533)
com.swmansion.reanimated.layoutReanimation.ReanimatedNativeHierarchyManager.manageChildren (ReanimatedNativeHierarchyManager.java:300)
com.facebook.react.uimanager.UIViewOperationQueue$ManageChildrenOperation.execute (UIViewOperationQueue.java:217)
com.facebook.react.uimanager.UIViewOperationQueue$1.run (UIViewOperationQueue.java:926)
com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches (UIViewOperationQueue.java:1037)
com.facebook.react.uimanager.UIViewOperationQueue.-$$Nest$mflushPendingBatches
com.facebook.react.uimanager.UIViewOperationQueue$2.runGuarded (UIViewOperationQueue.java:995)
com.facebook.react.bridge.GuardedRunnable.run (GuardedRunnable.java:29)
android.os.Handler.handleCallback (Handler.java:888)
android.os.Handler.dispatchMessage (Handler.java:100)
android.os.Looper.loop (Looper.java:213)
android.app.ActivityThread.main (ActivityThread.java:8178)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:513)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1101)

@Sumit-Budhiraja
Copy link

Facing the same issue, the crashes are increasing rapidly.

@abdymm
Copy link

abdymm commented Apr 24, 2024

hi @Willham12 can we consider to re-open this issue? we still don't know how to fix this, i got same issue

React Native: 0.72.13
reanimated: 3.7.0

@ivanngyb
Copy link

ivanngyb commented May 2, 2024

Hi anyone got a fix for this issue? Still happening for me. We can't seem to reproduce. Very random

 "react-native-reanimated": "3.8.1"
 "react-native": "0.73.6"

@BakkerTom
Copy link

BakkerTom commented May 2, 2024

We saw this bug show up when we released the latest version of our app. We upgraded react-native to 0.73.7 from 0.72.11. We haven't been able to reproduce the crash ourselves. The crash seems to occur on a screen where we used react native's LayoutAnimation.configureNext.

This normally shouldn't be an issue, as LayoutAnimation is turned off by default on Android and needs to be explicitly enabled. According to this issue, react-native-reanimated will enable the experimental layout animation on Android as a side-effect.

I am going to explicitly disable LayoutAnimation on Android, but because I don't have a reproduction path I can only verify if that fixes the crash when I put it in production.

@Harisene
Copy link

Harisene commented May 2, 2024

Hi @BakkerTom - Thanks for the update. Please do let us know once you verify it in production.

Meanwhile here is my stack trace. This is an intermittent issue. Not all Android devices experiencing this issue. None of our test devices can replicate this issue. Also, this app crash happens at the app startup.

Fatal Exception: java.lang.IndexOutOfBoundsException: index=2 count=1
       at android.view.ViewGroup.addInArray(ViewGroup.java:5644)
       at android.view.ViewGroup.addViewInner(ViewGroup.java:5531)
       at android.view.ViewGroup.addView(ViewGroup.java:5328)
       at com.facebook.react.views.view.ReactViewGroup.addView(ReactViewGroup.java:461)
       at android.view.ViewGroup.addView(ViewGroup.java:5268)
       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:541)
       at com.swmansion.reanimated.layoutReanimation.ReanimatedNativeHierarchyManager.manageChildren(ReanimatedNativeHierarchyManager.java:279)
       at com.facebook.react.uimanager.UIViewOperationQueue$ManageChildrenOperation.execute(UIViewOperationQueue.java:211)
       at com.facebook.react.uimanager.UIViewOperationQueue$1.run(UIViewOperationQueue.java:908)
       at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:1019)
       at com.facebook.react.uimanager.UIViewOperationQueue.access$2600(UIViewOperationQueue.java:47)
       at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:1079)
       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:1687)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1698)
       at android.view.Choreographer.doCallbacks(Choreographer.java:1153)
       at android.view.Choreographer.doFrame(Choreographer.java:1069)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1646)
       at android.os.Handler.handleCallback(Handler.java:958)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:230)
       at android.os.Looper.loop(Looper.java:319)
       at android.app.ActivityThread.main(ActivityThread.java:8919)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)

@normenster
Copy link

Because it doubled our crash rate on android (Multiple type of errors occured), we removed all of LayoutAnimation from our app, and replaced it with standard withTiming/withSpring Animations. I think it`s not ready for android yet.

@RobCrossland1
Copy link

RobCrossland1 commented Jun 3, 2024

@BakkerTom / @Harisene Did you have any luck with this?

We're getting a similar crash after upgrading React Native from 0.70.14 to 0.73.3 with react-native-animated: 3.8.1

 java.lang.IndexOutOfBoundsException: index=2 count=0
    at android.view.ViewGroup.addInArray(ViewGroup.java:5404)
    at android.view.ViewGroup.addViewInner(ViewGroup.java:5297)
    at android.view.ViewGroup.addView(ViewGroup.java:5104)
    at android.view.ViewGroup.addView(ViewGroup.java:5044)
    at com.facebook.react.uimanager.ViewGroupManager.addView(ViewGroupManager.java:38)
    at com.facebook.react.uimanager.NativeViewHierarchyManager.manageChildren(NativeViewHierarchyManager.java:533)
    at com.swmansion.reanimated.layoutReanimation.ReanimatedNativeHierarchyManager.manageChildren(ReanimatedNativeHierarchyManager.java:300)```

@Harisene
Copy link

Harisene commented Jun 3, 2024

@RobCrossland1 Not yet.

@phuongwd
Copy link

phuongwd commented Jun 8, 2024

Screenshot_1717851070

"react-native-reanimated": "^3.7.1"
"react-native": "0.73.6",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Close when stale This issue is going to be closed when there is no activity for a while Missing repro This issue need minimum repro scenario Needs review Issue is ready to be reviewed by a maintainer Platform: Android This issue is specific to Android Unable to repro
Projects
None yet
Development

No branches or pull requests