StackTrace:
Fatal Exception: java.lang.IndexOutOfBoundsException: Index 1 out of bounds for length 0
at jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
at jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266)
at java.util.Objects.checkIndex(Objects.java:359)
at java.util.ArrayList.get(ArrayList.java:434)
at android.view.ViewGroup.getAndVerifyPreorderedView(ViewGroup.java:3993)
at android.view.ViewGroup.gatherTransparentRegion(ViewGroup.java:7689)
at android.view.ViewGroup.gatherTransparentRegion(ViewGroup.java:7691)
at android.view.ViewGroup.gatherTransparentRegion(ViewGroup.java:7691)
at android.view.ViewGroup.gatherTransparentRegion(ViewGroup.java:7691)
at android.view.ViewGroup.gatherTransparentRegion(ViewGroup.java:7691)
at android.view.ViewGroup.gatherTransparentRegion(ViewGroup.java:7691)
at android.view.ViewGroup.gatherTransparentRegion(ViewGroup.java:7691)
at android.view.ViewGroup.gatherTransparentRegion(ViewGroup.java:7691)
at android.view.ViewGroup.gatherTransparentRegion(ViewGroup.java:7691)
at android.view.ViewGroup.gatherTransparentRegion(ViewGroup.java:7691)
at android.view.ViewGroup.gatherTransparentRegion(ViewGroup.java:7691)
at android.view.ViewGroup.gatherTransparentRegion(ViewGroup.java:7691)
at android.view.ViewGroup.gatherTransparentRegion(ViewGroup.java:7691)
at android.view.ViewGroup.gatherTransparentRegion(ViewGroup.java:7691)
at android.view.ViewGroup.gatherTransparentRegion(ViewGroup.java:7691)
at android.view.ViewGroup.gatherTransparentRegion(ViewGroup.java:7691)
at android.view.ViewGroup.gatherTransparentRegion(ViewGroup.java:7691)
at android.view.ViewGroup.gatherTransparentRegion(ViewGroup.java:7691)
at com.android.internal.policy.DecorView.gatherTransparentRegion(DecorView.java:611)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:4539)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:3288)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:11344)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1689)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1698)
at android.view.Choreographer.doCallbacks(Choreographer.java:1153)
at android.view.Choreographer.doFrame(Choreographer.java:1079)
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)
I am experiencing this crash on production in my react native app.
Not able to reproduce this till now.
Here are my findings
The crash could occur if the React Native view hierarchy is not fully rendered or if there is a race condition that causes the accessibility service to query for views before they are ready.
The crash suggests that a ViewGroup is trying to access a child view’s information at an index that does not exist. This might happen if a view’s children are being accessed without verifying that the index is within bounds.
The view hierarchy might be modified (e.g., adding/removing views) while the ViewGroup is iterating over its children, leading to an inconsistency in the list of child views.
The view list might be cleared or not properly populated at the time this method is called, leading to an attempt to access a view that doesn’t exist.
These are very generic findings. I am not able to repro this yet
shubham Gupta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.