java.lang.IllegalArgumentException

If you like a tip written by other Samebug users, mark is as helpful! Marks help our algorithm provide you better solutions and also help other users.
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.

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

  • GitHub comment 22#254712162
    via GitHub by Michael-Cyrus
    ,
  • GitHub comment 22#254713319
    via GitHub by Michael-Cyrus
    ,
  • GitHub comment 22#254721572
    via GitHub by Michael-Cyrus
    ,
  • Wrong item removed from list in UI
    via GitHub by gr3ger
    ,
  • Adding new item animations
    via GitHub by jjhesk
    ,
  • 效果很赞,但存在一点Bug
    via GitHub by Yellow5A5
    ,
    • 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:4878) at android.support.v7.widget.RecyclerView$Recycler.quickRecycleScrapView(RecyclerView.java:4951) at android.support.v7.widget.RecyclerView$LayoutManager.removeAndRecycleScrapInt(RecyclerView.java:7352) at android.support.v7.widget.RecyclerView.dispatchLayoutStep3(RecyclerView.java:3101) at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2917) at android.support.v7.widget.RecyclerView.consumePendingUpdateOperations(RecyclerView.java:1482) at android.support.v7.widget.RecyclerView.access$400(RecyclerView.java:147) at android.support.v7.widget.RecyclerView$1.run(RecyclerView.java:294) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725) at android.view.Choreographer.doCallbacks(Choreographer.java:555) at android.view.Choreographer.doFrame(Choreographer.java:524) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711) at android.os.Handler.handleCallback(Handler.java:615) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4819) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) at dalvik.system.NativeStart.main(Native Method)

    Users with the same issue

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