AbstractMethodError: abstract method "androidx.databinding.ViewDataBinding androidx.databinding.DataBinderMapper.getDataBinder(androidx.databinding.DataBindingComponent, android.view.View, int)"
混淆导致的数据绑定库错误
问题摘要
AbstractMethodError: abstract method "androidx.databinding.ViewDataBinding androidx.databinding.DataBinderMapper.getDataBinder(androidx.databinding.DataBindingComponent, android.view.View, int)"
堆栈如下:
java.lang.AbstractMethodError: abstract method "androidx.databinding.ViewDataBinding androidx.databinding.DataBinderMapper.getDataBinder(androidx.databinding.DataBindingComponent, android.view.View, int)"
at androidx.databinding.MergedDataBinderMapper.getDataBinder(MergedDataBinderMapper.java:74)
at androidx.databinding.DataBindingUtil.bind(DataBindingUtil.java:199)
at androidx.databinding.DataBindingUtil.inflate(DataBindingUtil.java:130)
at androidx.databinding.DataBindingUtil.inflate(DataBindingUtil.java:95)
at cn.sintoon.common.adapter.SinRecyclerViewBaseAdapter.onCreateViewHolder(Unknown Source:11)
at cn.sintoon.common.adapter.SinRecyclerViewBaseAdapter.onCreateViewHolder(Unknown Source:0)
at androidx.recyclerview.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6794)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5975)
at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5858)
at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5854)
at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2230)
at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1557)
at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1517)
at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:612)
at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3924)
at androidx.recyclerview.widget.RecyclerView.onMeasure(RecyclerView.java:3336)
at android.view.View.measure(View.java:23454)
at androidx.constraintlayout.widget.ConstraintLayout.internalMeasureChildren(ConstraintLayout.java:1227)
at androidx.constraintlayout.widget.ConstraintLayout.onMeasure(ConstraintLayout.java:1572)
at android.view.View.measure(View.java:23454)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6834)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at androidx.appcompat.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:143)
at android.view.View.measure(View.java:23454)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6834)
at androidx.appcompat.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:403)
at android.view.View.measure(View.java:23454)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6834)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.view.View.measure(View.java:23454)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6834)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1565)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:847)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:726)
at android.view.View.measure(View.java:23454)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6834)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at com.android.internal.policy.DecorView.onMeasure(DecorView.java:847)
at android.view.View.measure(View.java:23454)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2954)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1753)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2041)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1636)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7946)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1092)
at android.view.Choreographer.doCallbacks(Choreographer.java:893)
at android.view.Choreographer.doFrame(Choreographer.java:812)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1078)
at android.os.Handler.handleCallback(Handler.java:907)
出现场景
封装了一个类库,向外提供一个封装好的 RecyclerAdapter,使用 DataBinding 。生成类库时开启了混淆,在使用时,抛出异常。
问题原因
将 androidx.databinding.DataBindingComponent
混淆掉了。
如何修复
修改混淆规则。不混淆这个类。
-keep class androidx.databinding.DataBindingComponent {*;}
排查过程
根据错误堆栈看,是找不到这个方法,初步怀疑就是被混淆掉了方法,然后直接使用不混淆的测试,的确没有异常了。确认是混淆的问题。
然后在 /build/outputs/mapping/ 目录下查看 mapping.txt 文件,发现果然是将这类混淆掉了。
# compiler: R8
# compiler_version: 1.4.77
# min_api: 1
androidx.databinding.DataBindingComponent -> a.a.a:
mapping.txt 这个文件提供混淆前后类、方法、类成员等的对照表。
总结
在基础类库中使用了数据绑定库要配置混淆规则。
AbstractMethodError: abstract method "androidx.databinding.ViewDataBinding androidx.databinding.DataBinderMapper.getDataBinder(androidx.databinding.DataBindingComponent, android.view.View, int)"的更多相关文章
- 集成Glide4.3.1出错!AbstractMethodError: abstract method "void com.bumptech.glide.module
项目中原本是用的Glide3.7.0,一切功能正常,但是集成了网易云信的UIKIT后,就出问题了,发现是Glide4.0的问题. Glide4.0,始终会报这么一个错,就算是最简单的加载也仍然报错. ...
- must implement the inherited abstract method
The type VideoView must implement the inherited abstract method MediaController.MediaPlayerControl.g ...
- must implement the inherited abstract method DialogInterface.OnClickListener.onClick(DialogInterface, int)问题
依照视屏编写代码如下 class MyButtonListener implements OnClickListener{ @Override public void onClick(View v){ ...
- 抽象方法(abstract method) 和 虚方法 (virtual method), 重载(overload) 和 重写(override)的区别于联系
1. 抽象方法 (abstract method) 在抽象类中,可以存在没有实现的方法,只是该方法必须声明为abstract抽象方法. 在继承此抽象类的类中,通过给方法加上override关键字来实现 ...
- The type new View.OnClickListener(){} must implement the inherited abstract method View.Onclicklis
public class MainActivity extends Activity { protected Button startBrew = null; @Override protected ...
- android-xxxx must implement the inherited abstract method报错
public class ContactMainFragment extends Fragment implements OnClickListener { 提示:ContactMainFragmen ...
- JAVA-错误The type BookServiceImpl must implement the inherited abstract method
错误原因 :是因为class继承了其他的类,没有导入过来,选择add unimplemented methods进行解决
- 【Android Jetpack高手日志】DataBinding 从入门到精通
前言 DataBinding 数据绑定库是 Android Jetpack 的一部分,借助该库可以使用声明性格式(而非程序化地)将布局中的界面组件绑定到应用中的数据源.我个人觉得,使用 DataBin ...
- [Android Pro] AndroidX重构和映射
原文地址:https://developer.android.com/topic/libraries/support-library/refactor https://blog.csdn.net/ch ...
随机推荐
- Linux 命令之 scp 命令详解
Linux 命令之 scp 命令详解 一.scp 简介 scp 命令用于不同主机之间复制文件和目录. scp 是 secure copy 的缩写,是 基于 ssh 协议进行安全的远程文件拷贝命令. s ...
- 金蝶天燕中间拒绝put、delete请求解决方案
项目要求支持国产化,那就国产化呗!使用金蝶天燕中间件替代weblogic,一切部署好后发现所有以put.delete请求的按钮全部无效,原因是中间件配置文件默认拒绝put.delete请求 解决方案为 ...
- Prometheus 【目录】
正在陆续更新,内容大体包括: rule.标签重置.cAdversior.自动发现(File 自动发现.DNS自动发现.k8s环境自动发现)等... 目录: prometheus[第一篇] Promet ...
- scrapy框架安装配置
scrapy框架 scrapy安装(win) 1.pip insatll wheel 2.下载合适的版本的twisted:http://www.lfd.uci.edu/~gohlke/pythonli ...
- 【SSL题解报告】没有上司的舞会
题目: 题目描述 某大学有N个职员,编号为1~N.他们之间有从属关系,也就是说他们的关系就像一棵以校长为根的树,父结点就是子结点的直接上司.现在有个周年庆宴会,宴会每邀请来一个职员都会增加一定的快乐指 ...
- 链式栈-C语言实现
相对于顺序栈的空间有限,链式栈的操作则更加灵活 #include<stdio.h> #include<malloc.h> typedef int SElemType; //元素 ...
- 一道时间复杂度为O(N)空间复杂度为O(1)的排序问题
题目:对1, 2, ... , n的一个无序数组,排序,要求时间复杂度为O(N),空间复杂度为O(1). 思路:该题利用数组元素和数组下标相差1的关系,Java代码如下: import java.ut ...
- 源码分析—ThreadPoolExecutor线程池三大问题及改进方案
前言 在一次聚会中,我和一个腾讯大佬聊起了池化技术,提及到java的线程池实现问题,我说这个我懂啊,然后巴拉巴拉说了一大堆,然后腾讯大佬问我说,那你知道线程池有什么缺陷吗?我顿时哑口无言,甘拜下风,所 ...
- BZOJ [HNOI2006]鬼谷子的钱袋
1192: [HNOI2006]鬼谷子的钱袋 Time Limit: 10 Sec Memory Limit: 162 MBSubmit: 5367 Solved: 3646[Submit][St ...
- CodeForces-Round235D
链接:http://codeforces.com/contest/401/problem/D 题意:给出一个数字num和m,问通过重新排列num中的各位数字中有多少个数(mod m)=0,直接枚举 ...