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

Flutter执行CheckDuplicatesRunnable失败:ExoPlayer存在重复类

解决Flutter构建时:app:checkDebugDuplicateClasses失败问题

这个错误是因为项目里引入的ExoPlayer模块版本不匹配——exoplayer-core用的是2.18.0,而exoplayer-ui是2.14.1,两个模块里都存在com.google.android.exoplayer2.ui.DownloadNotificationHelper类,触发了重复类检查失败。

给你几个可行的解决办法:

  • 统一ExoPlayer所有模块的版本
    打开项目android/app/build.gradle文件,在android代码块里添加版本约束,强制所有依赖使用同一版本的ExoPlayer:

    android {
        // ... 其他配置
        configurations.all {
            resolutionStrategy.force 'com.google.android.exoplayer:exoplayer-core:2.18.0'
            resolutionStrategy.force 'com.google.android.exoplayer:exoplayer-ui:2.18.0'
        }
    }
    

    这样所有依赖都会使用指定的2.18.0版本,避免版本差异导致的冲突。

  • 排查并移除冲突的依赖
    先执行依赖树命令查看哪个第三方库引入了旧版本的exoplayer-ui:

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

    找到对应的库后,在dependencies块里排除它带的旧版ExoPlayer模块,比如:

    implementation('有问题的第三方库坐标') {
        exclude group: 'com.google.android.exoplayer', module: 'exoplayer-ui'
    }
    
  • 清理缓存后重新构建
    执行以下命令清理项目缓存,再重新构建:

    flutter clean
    flutter run
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.24 17:18:21