woocommerce / woocommerce-android

WooCommerce Android app
https://www.woocommerce.com/mobile
GNU General Public License v2.0
267 stars 133 forks source link

IllegalStateException: Two different ViewHolders have the same stable ID. Stable IDs in your adapter MUST BE unique and ... #2155

Closed sentry-io[bot] closed 1 week ago

sentry-io[bot] commented 4 years ago

Sentry Issue: WOOCOMMERCE-ANDROID-9F

IllegalStateException: Two different ViewHolders have the same stable ID. Stable IDs in your adapter MUST BE unique and SHOULD NOT change.
 ViewHolder 1:ProductViewHolder{31291e position=3 id=6591, oldPos=-1, pLpos:-1 not recyclable(1)} 
 View Holder 2:ProductViewHolder{cbe8470 position=2 id=6591, oldPos=-1, pLpos:-1} androidx.recyclerview.widget.RecyclerView{18b8e7e VFED..... ......ID 0,483-1080,1512 #7f0a02f8 app:id/productsRecycler}, adapter:com.woocommerce.android.ui.products.ProductListAdapter@14a3fdf, layout:androidx.recyclerview.widget.LinearLayoutManager@18d542c, context:com.woocommerce.android.ui.main.MainActivity@be0fefb
    at androidx.recyclerview.widget.RecyclerView.handleMissingPreInfoForChangeError(RecyclerView.java:4268)
    at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep3(RecyclerView.java:4192)
    at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:3862)
    at androidx.recyclerview.widget.RecyclerView.onLayout(RecyclerView.java:4404)
    at android.view.View.layout(View.java:20684)
...
(61 additional frame(s) were not displayed)

Two different ViewHolders have the same stable ID. Stable IDs in your adapter MUST BE unique and SHOULD NOT change.
 ViewHolder 1:ProductViewHolder{31291e position=3 id=6591, oldPos=-1, pLpos:-1 not recyclable(1)} 
 View Holder 2:ProductViewHolder{cbe8470 position=2 id=6591, oldPos=-1, pLpos:-1} androidx.recyclerview.widget.RecyclerView{18b8e7e VFED..... ......ID 0,483-1080,1512 #7f0a02f8 app:id/productsRecycler}, adapter:com.woocommerce.android.ui.products.ProductListAdapter@14a3fdf, layout:androidx.recyclerview.widget.LinearLayoutManager@18d542c, context:com.woocommerce.android.ui.main.MainActivity@be0fefb
anitaa1990 commented 4 years ago

This crash occurred last, 20 days ago in version 4.0. I think we can monitor the crash for another couple of releases and mark as resolved if it is not recurring in version 4.3

AmandaRiu commented 4 years ago

Set this event as resolved in Sentry. Sentry will notify us if it happens in later releases and alert us to the regression.

sentry-io[bot] commented 4 years ago

Popped up again in 4.4: Sentry issue: WOOCOMMERCE-ANDROID-K7

sentry-io[bot] commented 4 years ago

Sentry issue: WOOCOMMERCE-ANDROID-R2

sentry-io[bot] commented 3 years ago

Sentry issue: WOOCOMMERCE-ANDROID-WZ

sentry-io[bot] commented 3 years ago

Sentry issue: WOOCOMMERCE-ANDROID-1BD

nbradbury commented 3 years ago

Crash is happening again. Based on the RecyclerView source code here and here, this crash does appear to be due to duplicate view holder IDs, which is confirmed in the trace.

ViewHolder 1:ProductItemViewHolder{c0657b3 position=56 id=13050
ViewHolder 2:ProductItemViewHolder{51cbffd position=55 id=13050

It's unclear from the stack trace whether this is occuring in ProductListFragment or ProductSelectionListFragment, but the appearance of CoordinatorLayout in the trace suggests the former.

anitaa1990 commented 3 years ago

I wonder if this could be related to this bug in #3812. It looks like when we click on a variable product in Order detail, it redirects to the Product detail screen and this prompts a call to the GET Product API. This seems to be causing duplicate products to be displayed in the product list screen.

nbradbury commented 3 years ago

@anitaa1990 Great call, that most likely is the culprit!

anitaa1990 commented 3 years ago

Potentially fixed in #3822

rossanafmenezes commented 2 years ago

Reopening this since it happened again.

ViewHolder 1:ProductViewHolder{f3c18c9 position=2 id=21, oldPos=-1, pLpos:-1} View Holder 2:ProductViewHolder{dc5c4b3 position=1 id=21, oldPos=-1, pLpos:-1}

Only 1 user so far. Will keep an eye on the next few days to see if it goes up

App version: 9.0-rc-1 Android 11

AnirudhBhat commented 2 years ago

Heads up. This issue happened again in 9.1.1 for 2 users 7 times. Here's the latest occurrence

rossanafmenezes commented 1 year ago

Happening again in the Beta 11.7-rc-2 So far affecting only 1 user but the adoption rate is pretty low, so maybe we should keep an eye on this:

IllegalStateException
Two different ViewHolders have the same stable ID. Stable IDs in your adapter MUST BE unique and SHOULD NOT change.
 ViewHolder 1:ProductItemViewHolder{de0255b position=1 id=15083, oldPos=-1, pLpos:-1 not recyclable(1)} 
 View Holder 2:ProductItemViewHolder{934d1b0 position=0 id=15083, oldPos=-1, pLpos:-1} androidx.recyclerview.widget.RecyclerView{de16641 VFED..... ......ID 0,0-1812,1821 #7f0a0746 app:id/products_list}, adapter:com.woocommerce.android.ui.products.ProductListAdapter@d6687e6, layout:androidx.recyclerview.widget.LinearLayoutManager@3f42127, context:dagger.hilt.android.internal.managers.ViewComponentManager$FragmentContextWrapper@d01815c
hichamboushaba commented 1 week ago

This was fixed by https://github.com/woocommerce/woocommerce-android/pull/10373, but the ticket wasn't closed.