java.lang.IndexOutOfBoundsException

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

Samebug tips1

Try to use notifyDataSetChanged() instead of notifyItemRemoved(), there's a bug in RecyclerView and notifyItemRemoved() does not work in some environments.

Don't give up yet. Our experts can help. Paste your full stack trace to get a solution.

Solutions on the web3445

  • Inconsistency detected. Invalid view holder adapter positionViewHolder{21e958a8 position=18 id=-1, oldPos=18, pLpos:-1 scrap [attachedScrap] tmpDetached no parent}
  • Inconsistency detected. Invalid view holder adapter positionViewHolder{43272cb position=2 id=-1, oldPos=1, pLpos:1 scrap [attachedScrap] tmpDetached not recyclable(1) no parent}
  • Inconsistency detected. Invalid view holder adapter positionViewHolder{2aa946bb position=20 id=-1, oldPos=1, pLpos:1 scrap [attachedScrap] tmpDetached not recyclable(1) no parent}
  • Stack trace

    • java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionViewHolder{21e958a8 position=18 id=-1, oldPos=18, pLpos:-1 scrap [attachedScrap] tmpDetached no parent} at android.support.v7.widget.RecyclerView$Recycler.validateViewHolderForOffsetPosition(RecyclerView.java:4801) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4932) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4913) at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2029) at android.support.v7.widget.GridLayoutManager.layoutChunk(GridLayoutManager.java:531) at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1377) at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:578) at android.support.v7.widget.GridLayoutManager.onLayoutChildren(GridLayoutManager.java:170) at android.support.v7.widget.RecyclerView.dispatchLayoutStep1(RecyclerView.java:3211) at android.support.v7.widget.RecyclerView.onMeasure(RecyclerView.java:2782) at android.view.View.measure(View.java:16772) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5139) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404) at android.widget.LinearLayout.measureVertical(LinearLayout.java:695) at android.widget.LinearLayout.onMeasure(LinearLayout.java:588) at android.view.View.measure(View.java:16772) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5139) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404) at android.widget.LinearLayout.measureVertical(LinearLayout.java:695) at android.widget.LinearLayout.onMeasure(LinearLayout.java:588) at android.view.View.measure(View.java:16772) at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1624) at android.view.View.measure(View.java:16772) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5139) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404) at android.widget.LinearLayout.measureVertical(LinearLayout.java:695) at android.widget.LinearLayout.onMeasure(LinearLayout.java:588) at android.view.View.measure(View.java:16772) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5139) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404) at android.widget.LinearLayout.measureVertical(LinearLayout.java:695) at android.widget.LinearLayout.onMeasure(LinearLayout.java:588) at android.view.View.measure(View.java:16772) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5139) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at android.view.View.measure(View.java:16772) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5139) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404) at android.widget.LinearLayout.measureVertical(LinearLayout.java:695) at android.widget.LinearLayout.onMeasure(LinearLayout.java:588) at android.view.View.measure(View.java:16772) at android.support.v4.widget.DrawerLayout.onMeasure(DrawerLayout.java:1079) at android.view.View.measure(View.java:16772) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5139) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:135) at android.view.View.measure(View.java:16772) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5139) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404) at android.widget.LinearLayout.measureVertical(LinearLayout.java:695) at android.widget.LinearLayout.onMeasure(LinearLayout.java:588) at android.view.View.measure(View.java:16772) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5139)

    Write tip

    You have a different solution? A short tip here would help you and many other users who saw this issue last week.

    Users with the same issue

    Unknown user
    2 times, 8 months ago
    Unknown user
    Once, 10 months ago
    Unknown user
    Once, 1 year ago
    Once, 1 year ago
    Unknown user
    3 times, 4 months ago
    27 more bugmates