java.lang.IllegalStateException: Two different ViewHolders have the same stable ID. Stable IDs in your adapter MUST BE unique and SHOULD NOT change.
⚠️ Before posting ⚠️
- [x] This is a bug, not a question or an enhancement.
- [x] I've searched for similar issues and didn't find a duplicate.
- [x] I've written a clear and descriptive title for this issue, not just "Bug" or "Crash".
- [x] I agree to follow Nextcloud's Code of Conduct.
Steps to reproduce
When deleting files from local system because of #14738 I guess I accidentally (due to that laggy ui) have clicked on "favorite" directory and then choose to delete it?
Then this happened?
Expected behaviour
No crash
Actual behaviour
Cause of error
Exception in thread "main" 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:OCFileListItemViewHolder{c2af077 position=1 id=20, oldPos=-1, pLpos:-1 not recyclable(1)}
View Holder 2:OCFileListItemViewHolder{de723fd position=0 id=20, oldPos=-1, pLpos:-1} com.owncloud.android.ui.EmptyRecyclerView{8526eaa VFED..... ......ID 0,0-1080,2193 #7f0a02c0 app:id/list_root}, adapter:com.owncloud.android.ui.adapter.OCFileListAdapter@611ac87, layout:androidx.recyclerview.widget.LinearLayoutManager@c9e1802, context:com.owncloud.android.ui.activity.FileDisplayActivity@fa15ef0
at androidx.recyclerview.widget.RecyclerView.handleMissingPreInfoForChangeError(RecyclerView.java:4778)
at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep3(RecyclerView.java:4702)
at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:4367)
at androidx.recyclerview.widget.RecyclerView.consumePendingUpdateOperations(RecyclerView.java:2095)
at androidx.recyclerview.widget.RecyclerView$1.run(RecyclerView.java:468)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1415)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1424)
at android.view.Choreographer.doCallbacks(Choreographer.java:1024)
at android.view.Choreographer.doFrame(Choreographer.java:949)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1398)
at android.os.Handler.handleCallback(Handler.java:991)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loopOnce(Looper.java:232)
at android.os.Looper.loop(Looper.java:317)
at android.app.ActivityThread.main(ActivityThread.java:8787)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:871)
App information
- ID:
com.nextcloud.client - Version:
30310090 - Build flavor:
generic
Device information
- Brand:
Fairphone - Device:
FP4 - Model:
FP4 - Id:
AP4A.250205.002 - Product:
FP4eea
Firmware
- SDK:
35 - Release:
15 - Incremental:
25605100
Android version
Android 15
Device brand and model
FP4
Stock or custom OS?
Custom (explain in "additional information")
Nextcloud android app version
3.31.0
Nextcloud server version
31.0.0.18
Using a reverse proxy?
Yes
Android logs
No response
Server error logs
Additional information
CalyxOS 6.5.10
Hmm. This was supposed to be fixed previously. Looks same as #12342. 🤔
I could somehow trigger the same exception by deleting a photo directly from the media gallery view. After deleting the very first photo, there appeared weird glitches with other photos little further down, where one row somehow gets duplicated and replaces the following two pictures. When I then try to select one of the now 4 glitching photos with a long-press, I get the following traceback. App restart does not remove the glitch:
### Cause of error
```java
Exception in thread "main" 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:GalleryRowHolder{d26c81a position=3 id=1228777, oldPos=-1, pLpos:-1 not recyclable(1)}
View Holder 2:GalleryRowHolder{d3bc235 position=2 id=1228777, oldPos=-1, pLpos:-1} com.owncloud.android.ui.EmptyRecyclerView{3237241 VFED..... ......ID 0,0-1080,1638 #7f0a02dc app:id/list_root}, adapter:com.owncloud.android.ui.adapter.GalleryAdapter@98bbcd6, layout:androidx.recyclerview.widget.GridLayoutManager@22da3e6, context:com.owncloud.android.ui.activity.FileDisplayActivity@4dead3b
at androidx.recyclerview.widget.RecyclerView.handleMissingPreInfoForChangeError(RecyclerView.java:4778)
at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep3(RecyclerView.java:4702)
at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:4367)
at androidx.recyclerview.widget.RecyclerView.consumePendingUpdateOperations(RecyclerView.java:2095)
at androidx.recyclerview.widget.RecyclerView$1.run(RecyclerView.java:468)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1566)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1575)
at android.view.Choreographer.doCallbacks(Choreographer.java:1175)
at android.view.Choreographer.doFrame(Choreographer.java:1100)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1549)
at android.os.Handler.handleCallback(Handler.java:991)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loopOnce(Looper.java:232)
at android.os.Looper.loop(Looper.java:317)
at android.app.ActivityThread.main(ActivityThread.java:8934)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911)
App information
- ID:
com.nextcloud.client - Version:
30340190 - Build flavor:
generic
Device information
- Brand:
Xiaomi - Device:
sagit - Model:
MI 6 - Id:
BP1A.250505.005 - Product:
lineage_sagit
Firmware
- SDK:
35 - Release:
15 - Incremental:
1763224866