Open aloe20 opened 4 years ago
java.lang.NoSuchMethodException: com.chad.library.adapter.base.viewholder.BaseDataBindingHolder.
附议,一样的错。
解决了没
一样的错误。
-keep class com.chad.library.adapter.base.viewholder.BaseDataBindingHolder {*;}
没有用,加了还是报错,只能用老版本的写法,唉
没用DataBinding
, 但我这边用ViewBinding出现过类似的错误,看了下源码,是反射的时候报错了。
报错前:
class ViewBindingHolder<VB : ViewBinding>(val viewBinding: VB ) : BaseViewHolder(viewBinding.root)
修改后:
class ViewBindingHolder<VB : ViewBinding>(view: View) : BaseViewHolder(view) {
lateinit var viewBinding: VB
constructor(viewBinding: VB) : this(viewBinding.root) {
this.viewBinding = viewBinding
}
}
翻了下,报错在BaseQuickAdapter
中 722行 createBaseGenericKInstance
,的方法里报错。大概报错意思是找不到 xxxViewHolder(我这边就是ViewBindingHolder)的主构造(view:View),没用BaseDataBindingHolder,所以只能给个参考。
一样的错误。
已配置混淆规则,debug环境或AS4.0之前没问题 java.lang.ClassCastException: com.chad.library.adapter.base.viewholder.BaseViewHolder cannot be cast to com.chad.library.adapter.base.viewholder.BaseDataBindingHolder at e.c.b.d.c.a.i(:14) at e.e.a.b.a.a.z(:376) at e.e.a.b.a.a.A(:382) at e.e.a.b.a.a.onBindViewHolder(:75) at androidx.recyclerview.widget.RecyclerView$g.bindViewHolder(:7172) at androidx.recyclerview.widget.RecyclerView$v.H(:6037) at androidx.recyclerview.widget.RecyclerView$v.I(:6304) at androidx.recyclerview.widget.RecyclerView$v.p(:6143) at androidx.recyclerview.widget.RecyclerView$v.o(:6139) at androidx.recyclerview.widget.LinearLayoutManager$c.d(:2314) at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(:1631) at androidx.recyclerview.widget.LinearLayoutManager.fill(:1591) at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(:668) at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(:4141) at androidx.recyclerview.widget.RecyclerView.dispatchLayout(:3853) at androidx.recyclerview.widget.RecyclerView.onLayout(:4410) at android.view.View.layout(View.java:22114) at android.view.ViewGroup.layout(ViewGroup.java:6335) at e.i.a.a.a.a.onLayout(:629) at android.view.View.layout(View.java:22114) at android.view.ViewGroup.layout(ViewGroup.java:6335) at e.g.a.a.n.b.F(:148) at e.g.a.a.n.c.l(:43) at androidx.coordinatorlayout.widget.CoordinatorLayout.onLayout(:918) at android.view.View.layout(View.java:22114) at android.view.ViewGroup.layout(ViewGroup.java:6335) at androidx.drawerlayout.widget.DrawerLayout.onLayout(:1263) at android.view.View.layout(View.java:22114) at android.view.ViewGroup.layout(ViewGroup.java:6335) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:334) at android.widget.FrameLayout.onLayout(FrameLayout.java:270) at android.view.View.layout(View.java:22114) at android.view.ViewGroup.layout(ViewGroup.java:6335) at androidx.recyclerview.widget.RecyclerView$o.layoutDecoratedWithMargins(:9739) at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(:1689) at androidx.recyclerview.widget.LinearLayoutManager.fill(:1591) at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(:668) at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(:4141) at androidx.recyclerview.widget.RecyclerView.dispatchLayout(:3853) at androidx.recyclerview.widget.RecyclerView.onLayout(:4410) at android.view.View.layout(View.java:22114) at android.view.ViewGroup.layout(ViewGroup.java:6335) at androidx.viewpager2.widget.ViewPager2.onLayout(:526) at android.view.View.layout(View.java:22114) at android.view.ViewGroup.layout(ViewGroup.java:6335) at androidx.appcompat.widget.LinearLayoutCompat.A(:1649) at androidx.appcompat.widget.LinearLayoutCompat.v(:1503) at androidx.appcompat.widget.LinearLayoutCompat.onLayout(:1411) at android.view.View.layout(View.java:22114) at android.view.ViewGroup.layout(ViewGroup.java:6335) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:334) at android.widget.FrameLayout.onLayout(FrameLayout.java:270) at android.view.View.layout(View.java:22114) at android.view.ViewGroup.layout(ViewGroup.java:6335) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:334) at android.widget.FrameLayout.onLayout(FrameLayout.java:270) at android.view.View.layout(View.java:22114) at android.view.ViewGroup.layout(ViewGroup.java:6335) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:334) at android.widget.FrameLayout.onLayout(FrameLayout.java:270) at android.view.View.layout(View.java:22114) at android.view.ViewGroup.layout(ViewGroup.java:6335) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1839) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1683) at android.widget.LinearLayout.onLayout(LinearLayout.java:1592) at android.view.View.layout(View.java:22114) at android.view.ViewGroup.layout(ViewGroup.java:6335)