Two different ViewHolders have the same stable ID. Stable IDs in your adapter MUST BE unique and SHOULD NOT change.
See original GitHub issueI was trying to add multiple viewTypes, and this happens…
java.lang.IllegalStateException: Two different ViewHolders have the same stable ID. Stable IDs in your adapter MUST BE unique and SHOULD NOT change. ViewHolder 1:EpoxyViewHolder{epoxyModel=MunchRestaurantPricesModel_{providerImage=http://myhubber.me/img/backend/provider/zomato.com/logo.png, munchOffer=Standard Price, providerColor=#C9202D}MunchRestaurantPricesModel_{id=71503083113255448, viewType=2131558538, shown=true, addedToAdapter=false}, view=com.google.android.material.card.MaterialCardView{b62be44 VFE...C.. ......ID 56,1078-1384,1289}, super=EpoxyViewHolder{1fdf6c3 position=1 id=71503083113255448, oldPos=-1, pLpos:-1}} View Holder 2:EpoxyViewHolder{epoxyModel=MunchRestaurantPricesModel_{providerImage=http://myhubber.me/img/backend/provider/talabat.com/logo.png, munchOffer=Standard Price, providerColor=#FF6F00}MunchRestaurantPricesModel_{id=71503083113255448, viewType=2131558538, shown=true, addedToAdapter=false}, view=com.google.android.material.card.MaterialCardView{b9beb2d VFE...C.. ......ID 56,1345-1384,1556}, super=EpoxyViewHolder{d05c9a0 position=2 id=71503083113255448, oldPos=-1, pLpos:-1}} com.airbnb.epoxy.EpoxyRecyclerView{4d90862 VFED..... ......ID 0,0-1440,2722 #7f0a0222 app:id/restaurantRecycler}, adapter:com.airbnb.epoxy.EpoxyControllerAdapter@ec29df3, layout:androidx.recyclerview.widget.LinearLayoutManager@1ef7ab0, context:com.myhubber.myhubberr.ui.activities.munchItemDetails.MunchItemDetailsActivity@d67598a
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:8 (4 by maintainers)
epoxy hashes it for you. you should not be implementing
getItemId
, the base EpoxyModel class handles that. just set your id withid
. look at the source@Chullian Let check your
buildModels
code inEpoxyController
. Please make sure theid
of each model view is unique.