You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android 12设备出现NoClassDefFoundError崩溃问题求助

问题描述

Crashlytics监测到应用仅在Android 12设备上触发崩溃,具体报错如下:

java.lang.NoClassDefFoundError: Failed resolution of: Lj$/util/concurrent/ConcurrentHashMap;

怀疑问题与ProGuard混淆配置有关。

排查修复方案
  • 检查ProGuard配置,确保保留j$/util/concurrent/相关类,添加以下规则:
    -keep class j$.** { *; }
    -dontwarn j$.**
    
  • 验证依赖兼容性:Android 12对类加载逻辑有调整,确保项目中Compose、Coroutines等相关依赖使用最新稳定版本。
  • 临时验证是否为R8优化导致:在gradle.properties中添加以下配置,重新打包测试:
    android.enableR8.fullMode=false
    
    若崩溃消失,说明是R8全模式下的优化规则导致类被误删,需进一步细化ProGuard规则。

内容的提问来源于stack exchange,提问作者gianpaolo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.29 18:29:58