当前位置: 首页 > news >正文

java.lang.AssertionError: Binder ProxyMap has too many entries: 问题处理

异常栈:

*** Uncaught remote exception!  (Exceptions are not yet supported across processes.)
java.lang.AssertionError: Binder ProxyMap has too many entries: 21562 (total), 21560 (uncleared), 19487 (uncleared after GC). BinderProxy leak?
at android.os.BinderProxy$ProxyMap.set(BinderProxy.java:229)
at android.os.BinderProxy.getInstance(BinderProxy.java:422)
at android.os.Parcel.nativeReadStrongBinder(Native Method)
at android.os.Parcel.readStrongBinder(Parcel.java:2506)
at android.view.accessibility.IAccessibilityManager$Stub.onTransact(IAccessibilityManager.java:289)
at android.os.Binder.execTransactInternal(Binder.java:1159)
at android.os.Binder.execTransact(Binder.java:1123)

抛出位置

            if (size >= mWarnBucketSize) {final int totalSize = size();Log.v(Binder.TAG, "BinderProxy map growth! bucket size = " + size+ " total = " + totalSize);mWarnBucketSize += WARN_INCREMENT;if (Build.IS_DEBUGGABLE && totalSize >= CRASH_AT_SIZE) {// Use the number of uncleared entries to determine whether we should// really report a histogram and crash. We don't want to fundamentally// change behavior for a debuggable process, so we GC only if we are// about to crash.final int totalUnclearedSize = unclearedSize();if (totalUnclearedSize >= CRASH_AT_SIZE) {dumpProxyInterfaceCounts();dumpPerUidProxyCounts();Runtime.getRuntime().gc();throw new AssertionError("Binder ProxyMap has too many entries: "+ totalSize + " (total), " + totalUnclearedSize + " (uncleared), "+ unclearedSize() + " (uncleared after GC). BinderProxy leak?");} else if (totalSize > 3 * totalUnclearedSize / 2) {Log.v(Binder.TAG, "BinderProxy map has many cleared entries: "+ (totalSize - totalUnclearedSize) + " of " + totalSize+ " are cleared");}}}

原因:BinderProxy 代理过多
看logcat

2025-04-25 [23:20:21:048]04-25 11:20:18.222   785   856 V Binder  : BinderProxy descriptor histogram (top 10):
2025-04-25 [23:20:21:048]04-25 11:20:18.222   785   856 V Binder  :  #1: android.view.accessibility.IAccessibilityManagerClient x17672
2025-04-25 [23:20:21:048]04-25 11:20:18.222   785   856 V Binder  :  #2: android.content.IIntentReceiver x394
2025-04-25 [23:20:21:392]04-25 11:20:18.222   785   856 V Binder  :  #3: <cleared weak-ref> x160
2025-04-25 [23:20:21:392]04-25 11:20:18.222   785   856 V Binder  :  #4:  x114
2025-04-25 [23:20:21:392]04-25 11:20:18.222   785   856 V Binder  :  #5: android.database.IContentObserver x114
2025-04-25 [23:20:21:392]04-25 11:20:18.222   785   856 V Binder  :  #6: android.content.IContentProvider x102
2025-04-25 [23:20:21:392]04-25 11:20:18.222   785   856 V Binder  :  #7: android.view.IWindow x48
2025-04-25 [23:20:21:392]04-25 11:20:18.222   785   856 V Binder  :  #8: android.app.IServiceConnection x38
2025-04-25 [23:20:21:392]04-25 11:20:18.222   785   856 V Binder  :  #9: android.app.IApplicationThread x36
2025-04-25 [23:20:21:392]04-25 11:20:18.223   785   856 V Binder  :  #10: android.hardware.display.IDisplayManagerCallback x36
2025-04-25 [23:20:21:392]04-25 11:20:18.223   785   856 D Binder  : Per Uid Binder Proxy Counts:
2025-04-25 [23:20:21:392]04-25 11:20:18.223   785   856 D Binder  : UID : 1000  count = 12125
2025-04-25 [23:20:21:392]04-25 11:20:18.223   785   856 D Binder  : UID : 1002  count = 51
2025-04-25 [23:20:21:392]04-25 11:20:18.223   785   856 D Binder  : UID : 1041  count = 23
2025-04-25 [23:20:21:392]04-25 11:20:18.223   785   856 D Binder  : UID : 1068  count = 3
2025-04-25 [23:20:21:392]04-25 11:20:18.223   785   856 D Binder  : UID : 10016  count = 3
2025-04-25 [23:20:21:392]04-25 11:20:18.223   785   856 D Binder  : UID : 10038  count = 3
2025-04-25 [23:20:21:392]04-25 11:20:18.224   785   856 D Binder  : UID : 10040  count = 214
2025-04-25 [23:20:21:392]04-25 11:20:18.224   785   856 D Binder  : UID : 10042  count = 29
2025-04-25 [23:20:21:392]04-25 11:20:18.224   785   856 D Binder  : UID : 10043  count = 19
2025-04-25 [23:20:21:392]04-25 11:20:18.224   785   856 D Binder  : UID : 10045  count = 50
2025-04-25 [23:20:21:392]04-25 11:20:18.224   785   856 D Binder  : UID : 10047  count = 76
2025-04-25 [23:20:21:392]04-25 11:20:18.224   785   856 D Binder  : UID : 10049  count = 36
2025-04-25 [23:20:21:392]04-25 11:20:18.224   785   856 D Binder  : UID : 10052  count = 52
2025-04-25 [23:20:21:392]04-25 11:20:18.224   785   856 D Binder  : UID : 10054  count = 5
2025-04-25 [23:20:21:392]04-25 11:20:18.224   785   856 D Binder  : UID : 10065  count = 37
2025-04-25 [23:20:21:392]04-25 11:20:18.224   785   856 D Binder  : UID : 10069  count = 20
2025-04-25 [23:20:21:392]04-25 11:20:18.224   785   856 D Binder  : UID : 10078  count = 30
2025-04-25 [23:20:21:392]04-25 11:20:18.224   785   856 D Binder  : UID : 10086  count = 5
2025-04-25 [23:20:21:392]04-25 11:20:18.224   785   856 D Binder  : UID : 10088  count = 6001
2025-04-25 [23:20:21:392]04-25 11:20:18.224   785   856 D Binder  : UID : 10089  count = 30
2025-04-25 [23:20:21:392]04-25 11:20:18.224   785   856 D Binder  : UID : 10091  count = 7
2025-04-25 [23:20:21:392]04-25 11:20:18.224   785   856 D Binder  : UID : 10094  count = 8
2025-04-25 [23:20:21:392]04-25 11:20:18.224   785   856 D Binder  : UID : 10095  count = 9

其中android.view.accessibility.IAccessibilityManagerClient占用过多
从Android源码发现Toast中使用了这个类
猜测Toast调用过多导致

结论

移除过多的Toast显示,问题解决

相关文章:

  • 深入理解链表:从基础操作到高频面试题解析
  • Linux[开发工具]
  • 主流AI推理模型的详细说明、对比及总结表格
  • android录音生成wav
  • 铭记之日(3)——4.28
  • 【软件工程】需求分析详解
  • maven私服配置
  • 利用Python打印有符号十进制数的二进制原码、反码、补码
  • std::print 和 std::println
  • 万亿参数大模型网络瓶颈突破:突破90%网络利用率的技术实践
  • 【力扣刷题实战】丢失的数字
  • Java大师成长计划之第6天:Java流式API(Stream API)
  • Redis 小记
  • Cursor + Figma-Context-MCP ,让 Cursor 获取 Figma 设计图信息,实现 AI 生成页面的高度还原
  • 【3分钟准备前端面试】Hybrid开发 谷歌浏览器调试安卓app
  • ViTa-Zero:零样本视觉触觉目标 6D 姿态估计
  • 深入解析 Babylon.js 中的 TransformNode.lookAt 方法
  • 【Unity】 Dropdown默认选择不选择任何选项
  • 怎么把Ubuntu系统虚拟环境中启动命令做成系统服务可以后台运行?
  • 【“星瑞” O6 评测】 — llm CPU部署对比高通骁龙CPU
  • 纪念|海上金石学的兴盛与王昶《金石萃编》
  • 药明康德一季度净利增长89%,在手订单增超四成至523亿元
  • 巴防长称中俄可参与克什米尔恐袭事件国际调查,外交部回应
  • 公交公司须关注新出行需求:“单车巴士”能否常态化
  • 江西省宁都县政协原二级调研员谢亦礼被查
  • 三大猪企去年净利润同比均较大幅度增长,资产负债率齐降