java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionViewHolder{213d192 position=3 id=-1, oldPos=1, pLpos:1 scrap [attachedScrap] tmpDetached no parent}

tip
Do you find the tips below useful? Click on the to mark them and say thanks to poroszd . Or join the community to write better ones.
  1. 0
    samebug tip
    Try to use notifyDataSetChanged() instead of notifyItemRemoved(), there's a bug in RecyclerView and notifyItemRemoved() does not work in some environments.
    via GitHub by bottiger
  2. 0

    Adapter添加头布局的时候异常

    GitHub | 2 months ago | magic0908
    java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionViewHolder{c34ed8e position=1 id=-1, oldPos=0, pLpos:0 scrap [attachedScrap] tmpDetached no parent}
  3. 0

    Issue 77846 - android - IndexOutOfBoundsException in RecyclerView triggered by RecyclerView.onLayout() - Android Open Source Project - Issue Tracker - Google Project Hosting

    google.com | 11 months ago
    java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionViewHolder{419d9008 position=10 id=-1, oldPos=9, pLpos:9 scrap tmpDetached no parent}
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.IndexOutOfBoundsException

    Inconsistency detected. Invalid view holder adapter positionViewHolder{213d192 position=3 id=-1, oldPos=1, pLpos:1 scrap [attachedScrap] tmpDetached no parent}

    at android.support.v7.widget.RecyclerView$Recycler.validateViewHolderForOffsetPosition()
  2. Android v7
    RecyclerView.onLayout
    1. android.support.v7.widget.RecyclerView$Recycler.validateViewHolderForOffsetPosition(RecyclerView.java:5297)
    2. android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5479)
    3. android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5440)
    4. android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5436)
    5. android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2224)
    6. android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1551)
    7. android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1511)
    8. android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:595)
    9. android.support.v7.widget.RecyclerView.dispatchLayoutStep1(RecyclerView.java:3534)
    10. android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3310)
    11. android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3844)
    11 frames
  3. Android Platform
    ViewGroup.layout
    1. android.view.View.layout(View.java:16653)
    2. android.view.ViewGroup.layout(ViewGroup.java:5438)
    2 frames
  4. Android Support v4
    SwipeRefreshLayout.onLayout
    1. android.support.v4.widget.SwipeRefreshLayout.onLayout(SwipeRefreshLayout.java:636)
    1 frame
  5. Android Platform
    ViewGroup.layout
    1. android.view.View.layout(View.java:16653)
    2. android.view.ViewGroup.layout(ViewGroup.java:5438)
    3. android.widget.RelativeLayout.onLayout(RelativeLayout.java:1080)
    4. android.view.View.layout(View.java:16653)
    5. android.view.ViewGroup.layout(ViewGroup.java:5438)
    6. android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
    7. android.widget.FrameLayout.onLayout(FrameLayout.java:273)
    8. android.view.View.layout(View.java:16653)
    9. android.view.ViewGroup.layout(ViewGroup.java:5438)
    9 frames
  6. Android v7
    ActionBarOverlayLayout.onLayout
    1. android.support.v7.widget.ActionBarOverlayLayout.onLayout(ActionBarOverlayLayout.java:437)
    1 frame
  7. Android Platform
    FrameLayout.onLayout
    1. android.view.View.layout(View.java:16653)
    2. android.view.ViewGroup.layout(ViewGroup.java:5438)
    3. android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
    4. android.widget.FrameLayout.onLayout(FrameLayout.java:273)
    5. android.view.View.layout(View.java:16653)
    6. android.view.ViewGroup.layout(ViewGroup.java:5438)
    7. android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
    8. android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586)
    9. android.widget.LinearLayout.onLayout(LinearLayout.java:1495)
    10. android.view.View.layout(View.java:16653)
    11. android.view.ViewGroup.layout(ViewGroup.java:5438)
    12. android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
    13. android.widget.FrameLayout.onLayout(FrameLayout.java:273)
    13 frames
  8. Android
    PhoneWindow$DecorView.onLayout
    1. com.android.internal.policy.PhoneWindow$DecorView.onLayout(PhoneWindow.java:2678)
    1 frame
  9. Android Platform
    ActivityThread.main
    1. android.view.View.layout(View.java:16653)
    2. android.view.ViewGroup.layout(ViewGroup.java:5438)
    3. android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2198)
    4. android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1958)
    5. android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1134)
    6. android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6050)
    7. android.view.Choreographer$CallbackRecord.run(Choreographer.java:860)
    8. android.view.Choreographer.doCallbacks(Choreographer.java:672)
    9. android.view.Choreographer.doFrame(Choreographer.java:608)
    10. android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:846)
    11. android.os.Handler.handleCallback(Handler.java:739)
    12. android.os.Handler.dispatchMessage(Handler.java:95)
    13. android.os.Looper.loop(Looper.java:148)
    14. android.app.ActivityThread.main(ActivityThread.java:5441)
    14 frames
  10. Java RT
    Method.invoke
    1. java.lang.reflect.Method.invoke(Native Method)
    1 frame
  11. Android
    ZygoteInit.main
    1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:738)
    2. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:628)
    2 frames