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

集成MoEngage SDK遇启动崩溃:ProcessLifecycleOwner解析失败

解决MoEngage SDK启动崩溃(NoClassDefFoundError: ProcessLifecycleOwner)

崩溃日志显示找不到androidx.lifecycle.ProcessLifecycleOwner类,这是MoEngage SDK依赖的AndroidX Lifecycle组件缺失或版本不兼容导致的,以下是具体解决步骤:

  • 添加AndroidX Lifecycle依赖
    MoEngage 3.x版本依赖AndroidX的Lifecycle进程组件,需在app模块的build.gradle中引入:

    implementation "androidx.lifecycle:lifecycle-process:2.6.2"
    

    版本可根据项目适配的AndroidX版本调整,建议使用官方稳定版。若项目仍在使用Support库,需先完成AndroidX迁移,MoEngage 3.x不支持Support库。

  • 排查并解决依赖冲突
    执行命令查看项目依赖树:

    # macOS/Linux
    ./gradlew app:dependencies
    # Windows
    gradlew.bat app:dependencies
    

    检查是否有其他库限制了Lifecycle组件的版本,导致lifecycle-process未被正确引入。若存在冲突,可在根目录build.gradle中统一强制指定版本:

    allprojects {
        configurations.all {
            resolutionStrategy {
                force "androidx.lifecycle:lifecycle-process:2.6.2"
            }
        }
    }
    
  • 清理缓存并重建项目
    执行清理构建命令,避免缓存导致的依赖同步问题:

    # macOS/Linux
    ./gradlew clean build
    # Windows
    gradlew.bat clean build
    
  • 确认AndroidX配置
    检查项目根目录gradle.properties文件,确保开启AndroidX和Jetifier:

    android.useAndroidX=true
    android.enableJetifier=true
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.06 19:30:04