xiaobinAndroid421726260 / KotlinMvvmWanAndroid

32 stars 13 forks source link

点我的直接崩溃了 #1

Open 1025342523 opened 2 years ago

1025342523 commented 2 years ago

E/AndroidRuntime: FATAL EXCEPTION: main Process: com.kotlin.mvvm, PID: 17943 java.lang.IllegalArgumentException: Called attach on a child which is not detached: BaseViewHolder{830314c position=0 id=-1, oldPos=-1, pLpos:-1} androidx.recyclerview.widget.RecyclerView{8525595 VFED..... ......ID 0,152-1020,1052 #7f0801b2 app:id/recyclerView}, adapter:com.kotlin.mvvm.ui.my.MyAdapter@76006aa, layout:androidx.recyclerview.widget.LinearLayoutManager@766d29b, context:com.kotlin.mvvm.ui.MainActivity@375610c at androidx.recyclerview.widget.RecyclerView$5.attachViewToParent(RecyclerView.java:953) at androidx.recyclerview.widget.ChildHelper.attachViewToParent(ChildHelper.java:239) at androidx.recyclerview.widget.RecyclerView.addAnimatingView(RecyclerView.java:1504) at androidx.recyclerview.widget.RecyclerView.animateChange(RecyclerView.java:4565) at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep3(RecyclerView.java:4368) at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:4031) at androidx.recyclerview.widget.RecyclerView.consumePendingUpdateOperations(RecyclerView.java:2017) at androidx.recyclerview.widget.RecyclerView$1.run(RecyclerView.java:417) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1079) at android.view.Choreographer.doCallbacks(Choreographer.java:885) at android.view.Choreographer.doFrame(Choreographer.java:806) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1065) at android.os.Handler.handleCallback(Handler.java:891) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:207) at android.app.ActivityThread.main(ActivityThread.java:7470) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958)

xiaobinAndroid421726260 commented 2 years ago

已经解决了, 在我的几个测试机上并不是每次都复现, 所以没注意