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

生成签名APK时遭遇重复类Entry错误,寻求技术解决方案

解决生成签名APK时的duplicate entry: com/google/android/gms/internal/measurement/zzabn.class错误

这个报错的核心原因很明确:你的项目里有多个依赖重复引入了Google Play Services的Measurement模块,或者不同依赖使用了该模块的不同版本,导致打包时出现类文件重复冲突。下面是几个针对性的解决步骤,按顺序尝试即可:

  • 统一Google Play Services依赖版本
    首先在项目根目录的build.gradle里定义一个统一的GMS版本号,避免不同依赖用不同版本导致冲突:

    buildscript {
        ext {
            gmsVersion = '16.0.0' // 选一个和你的compileSdkVersion 26兼容的稳定版本,也可以根据需求调整
        }
        repositories {
            google()
            jcenter()
        }
        // ... 其他buildscript配置
    }
    

    然后在app模块的build.gradle中,所有和Google Play Services相关的依赖都使用这个统一版本:

    implementation "com.google.android.gms:play-services-analytics:$gmsVersion"
    implementation "com.google.android.gms:play-services-auth:$gmsVersion"
    // 其他gms相关依赖都按这个格式写
    
  • 手动排除重复的Measurement依赖
    如果某个第三方库内部已经偷偷包含了Measurement模块,你可以在依赖声明里把它排除掉,比如:

    implementation('com.example.somelibrary:your-library:1.0.0') {
        exclude group: 'com.google.android.gms', module: 'play-services-measurement'
        exclude group: 'com.google.android.gms', module: 'play-services-measurement-sdk'
    }
    
  • 用依赖树排查冲突根源
    打开终端,运行./gradlew app:dependencies(Windows系统用gradlew.bat app:dependencies),查看完整的依赖树,找到所有引入play-services-measurement的节点,就能精准定位是哪个依赖在搞事情,然后针对性处理。

  • 清理重建项目
    最后执行Build > Clean Project,再点Build > Rebuild Project,之后再尝试生成签名APK,一般就能解决问题了。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.26 10:58:53