I have a bunch of RecyclerViews throughout my application and have been seeing this exception in Fabric for a while now.
Stacktrace:
Fatal Exception: java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid item position 8(offset:8).state:11 android.support.v7.widget.RecyclerView{3914473e VFED.... ........ 0,0-1080,1509 #7f11017a app:id/chatlist_recycler_view}, adapter:com.myapp.application.a.c@134b699f, layout:android.support.v7.widget.LinearLayoutManager@1449aec, context:com.myapp.application.activities.HomeActivity@1fcf5f5e
at android.support.v7.widget.RecyclerView$Recycler.clear(Unknown Source)
at android.support.v7.widget.GapWorker.add(Unknown Source)
at android.support.v7.widget.GapWorker.add(Unknown Source)
at android.support.v7.widget.GapWorker.remove(Unknown Source)
at android.support.v7.widget.GapWorker.add(Unknown Source)
at android.support.v7.widget.GapWorker.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5951)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)
Looking at this updated stacktrace, it seems like it's an issue with my chatlist_recycler_view
.
How should I go about debugging this and fixing it? I don't know what is causing the IndexOutOfBoundsException.
Code from the RecyclerView declaration:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/chatlist_recycler_view"
android:background="@android:color/white"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:isScrollContainer="false"/>
</RelativeLayout>
If you guys need any other code please let me know!
Adapter code can be found here: