Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
View issue level access limits(Press Alt + Right arrow for more information)
Unintended behavior
View staffing
Description
Array index out of range: -1
RecyclerView with StaggeredGridLayoutManager is having problems. The problem arises when we start the grid activity or screen, switch to another activity, and then return to the grid activity.
The application occasionally crashes with the ArrayIndexOutOfBoundsException exception listed below. I am aware that recyclerview release 1.2.0-alpha05 fixed the other issues that were similar. However, there is now a problem with androidx.recyclerview v1.4.0.
OS: Android 14
recyclerview: 1.4.0
Device: Pixel 9
Stack Trace:
Fatal Exception: java.lang.ArrayIndexOutOfBoundsException: Array index out of range: -1
at java.util.Arrays.rangeCheck(Arrays.java:730)
at java.util.Arrays.fill(Arrays.java:3251)
at androidx.recyclerview.widget.StaggeredGridLayoutManager$LazySpanLookup.invalidateAfter(StaggeredGridLayoutManager.java:2898)
at androidx.recyclerview.widget.StaggeredGridLayoutManager.handleUpdate(StaggeredGridLayoutManager.java:1570)
at androidx.recyclerview.widget.StaggeredGridLayoutManager.onItemsUpdated(StaggeredGridLayoutManager.java:1546)
at androidx.recyclerview.widget.RecyclerView$7.dispatchUpdate(RecyclerView.java:1165)
at androidx.recyclerview.widget.RecyclerView$7.onDispatchFirstPass(RecyclerView.java:1153)
at androidx.recyclerview.widget.AdapterHelper.dispatchFirstPassAndUpdateViewHolders(AdapterHelper.java:315)
at androidx.recyclerview.widget.AdapterHelper.dispatchAndUpdateViewHolders(AdapterHelper.java:301)
at androidx.recyclerview.widget.AdapterHelper.applyUpdate(AdapterHelper.java:221)
at androidx.recyclerview.widget.AdapterHelper.preProcess(AdapterHelper.java:105)
at androidx.recyclerview.widget.RecyclerView.processAdapterUpdatesAndSetAnimationFlags(RecyclerView.java:4389)
at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep1(RecyclerView.java:4637)
at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:4457)
at androidx.recyclerview.widget.RecyclerView.onLayout(RecyclerView.java:5011)
at android.view.View.layout(View.java:23793)
at android.view.ViewGroup.layout(ViewGroup.java:6413)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
at android.view.View.layout(View.java:23793)
at android.view.ViewGroup.layout(ViewGroup.java:6413)