[android] RecyclerView and java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionViewHolder in Samsung devices

In my case every time when I call notifyItemRemoved(0), it crashed. Turned out that I set setHasStableIds(true) and in getItemId I just returned the item position. I ended out updating it to return the item's hashCode() or self-defined unique id, which solved the issue.