Closed patrykserek closed 4 years ago
Hi
I've created a new project with your code samples and sadly could not reproduce this behavior. you can check the project here: https://drive.google.com/file/d/1Wnd-k2W1eW6Xak3PuHSlBwTbPPX8eoQK/view?usp=sharing tell me if you can run it or having the same issue.
Is this issue happens in OneAdapter's sample application? https://github.com/ironSource/OneAdapter/tree/master/sample
I had the same problem only happens in real device. it occured when i use nested recyclerViews so creating OneAdapter instance in my item module for horizontal recycler view row was the cause. I removed that part and used regular Recycler adapter. It worked that way.
Same problem here :( And also with the nested recycler view. Shame the only solution seems to be not using the OneAdapter.
Various causes for this exception can be seen here. Is there some hotfix for this? Otherwise I will have to use a different adapter. And that would be sad. I like OneAdapter a lot. It is super clean and just nice. BTW Thanks for reopening this issue.
This crash is one of the trickiest to track find and fix, it's very generic. Can you please share a minimal project as possible that produces this bug with a nested RecyclerView?
I reproduced the bug and it will be fixed in the next version. hopefully will be released tomorrow :)
@idanatz when i set itemAnimator = null the bug is fixed for now. maybe it helps.
Edit: It is not nested in this case btw.
Version v1.4.0 is out with the fix, really hope it would solve your issues. Please check the CHANGELOG and the README.
Hi, i have the same problem with the 2.0.1 version. it happens only in huwaei devices.. here the log:
atal Exception: java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionViewHolder{12a69d5 position=1 id=8843833539784609743, oldPos=0, pLpos:0 scrap [attachedScrap] tmpDetached not recyclable(1) no parent} androidx.recyclerview.widget.RecyclerView{1b55053 VFED..... ......ID 48,1019-1032,1506 #7f090304 app:id/recyclerView}, adapter:e.e.a.c.b@bdead90, layout:androidx.recyclerview.widget.LinearLayoutManager@411f689, context:+MainActivity@b082bdb at androidx.recyclerview.widget.RecyclerView$Recycler.validateViewHolderForOffsetPosition(RecyclerView.java:5974) at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6158) at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6118) at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6114) at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2303) at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1627) at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1587) at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:665) at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep1(RecyclerView.java:4085) at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:3849) at androidx.recyclerview.widget.RecyclerView.onLayout(RecyclerView.java:4404) at android.view.View.layout(View.java:19781) at android.view.ViewGroup.layout(ViewGroup.java:6144) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1816) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1660) at android.widget.LinearLayout.onLayout(LinearLayout.java:1569) at android.view.View.layout(View.java:19781) at android.view.ViewGroup.layout(ViewGroup.java:6144) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:325) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout(View.java:19781) at android.view.ViewGroup.layout(ViewGroup.java:6144) at androidx.constraintlayout.widget.ConstraintLayout.onLayout(ConstraintLayout.java:1855) at android.view.View.layout(View.java:19781) at android.view.ViewGroup.layout(ViewGroup.java:6144) at androidx.drawerlayout.widget.DrawerLayout.onLayout(DrawerLayout.java:1263) at android.view.View.layout(View.java:19781) at android.view.ViewGroup.layout(ViewGroup.java:6144) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:325) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout(View.java:19781) at android.view.ViewGroup.layout(ViewGroup.java:6144) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1816) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1660) at android.widget.LinearLayout.onLayout(LinearLayout.java:1569) at android.view.View.layout(View.java:19781) at android.view.ViewGroup.layout(ViewGroup.java:6144) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:325) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout(View.java:19781) at android.view.ViewGroup.layout(ViewGroup.java:6144) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1816) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1660) at android.widget.LinearLayout.onLayout(LinearLayout.java:1569) at android.view.View.layout(View.java:19781) at android.view.ViewGroup.layout(ViewGroup.java:6144) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:325) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at com.android.internal.policy.DecorView.onLayout(DecorView.java:888) at android.view.View.layout(View.java:19781) at android.view.ViewGroup.layout(ViewGroup.java:6144) at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2681) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2384) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1522) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7292) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:981) at android.view.Choreographer.doCallbacks(Choreographer.java:790) at android.view.Choreographer.doFrame(Choreographer.java:721) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:967) at android.os.Handler.handleCallback(Handler.java:808) at android.os.Handler.dispatchMessage(Handler.java:101) at android.os.Looper.loop(Looper.java:166) at android.app.ActivityThread.main(ActivityThread.java:7529) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
Same on a Nexus 5 yesterday on 2.0.0
Same on Samsung Galaxy S20
v2.1.0 is out with different diffing mechanism implementation, hoping it will solve this bug for good. 🤞 please note that the dependency has changed as well due to the deprecation of the current publication, so take a look at the README.
I reproduced the bug and it will be fixed in the next version. hopefully will be released tomorrow :)
How did you reproduce and fix it? Could you share it please....
v2.1.0 is out with different diffing mechanism implementation, hoping it will solve this bug for good. 🤞 please note that the dependency has changed as well due to the deprecation of the current publication, so take a look at the README.
How did you solve it? I would really appreciate your advice or suggestions. Thank you so much in advance for your help!
I followed a basic usage tutorial and I got a exception:
Below you can find my classes.
Model:
ItemModule:
Adapter initialization:
I execute all of the code on the main thread, so modification on the background thread is not the reason for the exception. I would be very grateful if you consider my request ASAP.