software-mansion / react-native-reanimated

React Native's Animated library reimplemented
https://docs.swmansion.com/react-native-reanimated/
MIT License
8.85k stars 1.29k forks source link

java.lang.IndexOutOfBoundsException: index=2 count=0 on Android #6519

Open jacobarvidsson opened 1 day ago

jacobarvidsson commented 1 day ago

Description

We are getting this error when react native is initialising (app start). We started seeing this after upgrading from react-native 0.73.8 to 0.74.5. We have tried several react-native-reanimated versions, 3.8.0, 3.14.0 and 3.15.1.

The issue is difficult to reproduce manually but happens on every other PR running our automated appium tests on Saucelabs. The issue does not seem to happen to every device, but mostly pixel devices running android 12.

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)

The issue has previously been reported here: https://github.com/software-mansion/react-native-reanimated/issues/3856 however the issue is not the same as the author describes, though it is the same issue as several of the comments mentions.

Issue seems to happen on multiple react native and reanimated versions. Some comments seems to hint on the fact that LayoutAnimations could be the cause, however we are able to reproduce this even with LayoutAnimations disabled.

Steps to reproduce

  1. Start the app, the issue appears as soon as react-native is loading.

Snack or a link to a repository

No specific code causes this issue, its during the start of the app.

Reanimated version

3.15.1

React Native version

0.74.5

Platforms

Android

JavaScript runtime

Hermes

Workflow

React Native

Architecture

Paper (Old Architecture)

Build type

Debug app & production bundle

Device

Real device

Device model

Google Pixel 4

Acknowledgements

Yes

github-actions[bot] commented 1 day ago

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?

hamdij0maa commented 1 day ago

+1

rosen777 commented 1 day ago

+1