yanzhenjie / SwipeRecyclerView

:melon: RecyclerView侧滑菜单,Item拖拽,滑动删除Item,自动加载更多,HeaderView,FooterView,Item分组黏贴。
https://github.com/yanzhenjie/SwipeRecyclerView
Apache License 2.0
5.65k stars 1.09k forks source link

AndroidX Proguard Error... #250

Closed TejNote closed 5 years ago

TejNote commented 5 years ago

java.lang.IllegalStateException: ViewHolder views must not be attached when created. Ensure that you are not passing 'true' to the attachToRoot parameter of LayoutInflater.inflate(..., boolean attachToRoot) at androidx.recyclerview.widget.RecyclerView$a.b(RecyclerView.java:6796) at androidx.recyclerview.widget.RecyclerView$p.a(RecyclerView.java:5975) at androidx.recyclerview.widget.RecyclerView$p.a(RecyclerView.java:5858) at androidx.recyclerview.widget.RecyclerView$p.c(RecyclerView.java:5854) at androidx.recyclerview.widget.LinearLayoutManager$c.a(LinearLayoutManager.java:2230) at androidx.recyclerview.widget.LinearLayoutManager.a(LinearLayoutManager.java:1557) at androidx.recyclerview.widget.LinearLayoutManager.a(LinearLayoutManager.java:1517) at androidx.recyclerview.widget.LinearLayoutManager.c(LinearLayoutManager.java:612) at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3924) at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:3641) at androidx.recyclerview.widget.RecyclerView.onLayout(RecyclerView.java:4194) at android.view.View.layout(View.java:20841) at android.view.ViewGroup.layout(ViewGroup.java:6401) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout(View.java:20841) at android.view.ViewGroup.layout(ViewGroup.java:6401) at androidx.swiperefreshlayout.widget.SwipeRefreshLayout.onLayout(SwipeRefreshLayout.java:625) at android.view.View.layout(View.java:20841) at android.view.ViewGroup.layout(ViewGroup.java:6401) at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1080) at android.view.View.layout(View.java:20841) at android.view.ViewGroup.layout(ViewGroup.java:6401) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout(View.java:20841) at android.view.ViewGroup.layout(ViewGroup.java:6401) at androidx.constraintlayout.widget.ConstraintLayout.onLayout(ConstraintLayout.java:1915) at android.view.View.layout(View.java:20841) at android.view.ViewGroup.layout(ViewGroup.java:6401) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout(View.java:20841) at android.view.ViewGroup.layout(ViewGroup.java:6401) at androidx.constraintlayout.widget.ConstraintLayout.onLayout(ConstraintLayout.java:1915) at android.view.View.layout(View.java:20841) at android.view.ViewGroup.layout(ViewGroup.java:6401) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout(View.java:20841) at android.view.ViewGroup.layout(ViewGroup.java:6401) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1791) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1635) at android.widget.LinearLayout.onLayout(LinearLayout.java:1544) at android.view.View.layout(View.java:20841) at android.view.ViewGroup.layout(ViewGroup.java:6401) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout(View.java:20841) at android.view.ViewGroup.layout(ViewGroup.java:6401) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1791) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1635) at android.widget.LinearLayout.onLayout(LinearLayout.java:1544) at android.view.View.layout(View.java:20841) at android.view.ViewGroup.layout(ViewGroup.java:6401) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at com.android.internal.policy.DecorView.onLayout(DecorView.java:944)

As with issue number 226, this error is also happening in androidx. So I applied ProGuard to the way I presented it, but I am getting the same error.

https://github.com/yanzhenjie/SwipeRecyclerView/issues/226

-keepclasseswithmembers class androidx.recyclerview.widget.RecyclerView$ViewHolder { public final View *; }

please check.

jamiedream commented 5 years ago

same here. This issue happens in android.v7 as well. I did some test today and found that if I use setSwipeMenuCreator, SwipeMenuCreator or SwipeMenuItem it happened.