java.lang.IllegalArgumentException

Scrapped or attached views may not be recycled. isScrap:false isAttached:true

Samebug tips2

tip

This happens when you have android:animateLayoutChanges set to true in your XML file and you call notifyDataSetChanged(). To fix it, you have to set android:animateLayoutChanges to false.

tip

In your xml just avoid using android:animateLayoutChanges with RecyclerViews.and also if you have set android:focusableInTouchMode="true" in your RecycleView you have to set false.

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

Solutions on the web40

  • via GitHub by u2u4u
    ,
  • Stack trace

    • java.lang.IllegalArgumentException: Scrapped or attached views may not be recycled. isScrap:false isAttached:true at android.support.v7.widget.RecyclerView$Recycler.recycleViewHolderInternal(RecyclerView.java:3586) at android.support.v7.widget.RecyclerView$Recycler.recycleView(RecyclerView.java:3535) at com.tonicartos.superslim.LayoutState.recycleCache(LayoutState.java:52) at com.tonicartos.superslim.LayoutManager.scrollVerticallyBy(LayoutManager.java:366) at android.support.v7.widget.RecyclerView$ViewFlinger.run(RecyclerView.java:2797) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858) at android.view.Choreographer.doCallbacks(Choreographer.java:670) at android.view.Choreographer.doFrame(Choreographer.java:603) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

    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

    Hiren AmaliyarHiren Amaliyar
    8 times, last one,
    rafaelrafael
    1 times, last one,
    mrokay97mrokay97
    12 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    6 more bugmates