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

React Native集成Zoom SDK升级后Release打包报错:Type a.a重复定义

解决React Native集成Zoom Video SDK 1.5.3版本Release打包重复类错误

问题描述

开发React Native项目时,将Zoom Video SDK从1.2.0升级到1.5.3后,Debug模式可正常构建运行,但Release打包时触发:app:mergeDexRelease任务失败,核心错误为:

com.android.builder.dexing.DexArchiveMergerException: 合并dex归档时出错:
Type a.a在以下文件中重复定义:
/Users/macbookpro/Desktop/healing-center-mobile/android/app/build/intermediates/external_libs_dex/release/mergeExtDexRelease/classes.dex、/Users/macbookpro/Desktop/healing-center-mobile/android/mobilertc/build/.transforms/e16cb3969562dbd5409148a5e09af52c/transformed/jetified-mobilertc-runtime/classes.dex

已尝试的方法

  • 在app/build.gradle中添加依赖元数据禁用配置:
    dependenciesInfo {
        // Disables dependency metadata when building APKs.
        includeInApk = false
        // Disables dependency metadata when building Android App Bundles.
        includeInBundle = false
    }
    
  • 启用MultiDex并添加依赖:
    multiDexEnabled true
    implementation 'androidx.multidex:multidex:2.0.1'
    
  • 尝试排除mobilertc的重复模块:
    implementation (project(':mobilertc')) {
        exclude module: 'duplicated module'
    }
    
  • 添加Guava依赖:
    implementation("com.google.guava:guava:24.0-jre")
    
  • 执行过Android Studio的Invalidate Caches、删除node_modules后重新安装

针对性解决方案

1. 精准定位重复依赖

执行Gradle命令生成依赖树,排查具体重复的库:

./gradlew app:dependencies --configuration releaseRuntimeClasspath

搜索输出中与a.a类相关的依赖(注意这是混淆后的类名,需结合Zoom SDK的依赖链分析),找到重复的group和module后,在app/build.gradle中精准排除:

implementation (project(':mobilertc')) {
    exclude group: '实际重复的group名', module: '实际重复的module名'
}

2. 配置Zoom SDK专属混淆规则

Release打包的混淆可能导致类名冲突,在app/proguard-rules.pro中添加Zoom官方混淆规则:

-keep class us.zoom.** { *; }
-keep class com.zipow.** { *; }
-dontwarn us.zoom.**
-dontwarn com.zipow.**

同时确保Release构建开启混淆并应用该规则:

buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}

3. 彻底清理构建缓存

除了IDE的Invalidate Caches,手动清理Android构建目录:

cd android
./gradlew clean
rm -rf .gradle build
rm -rf app/build

之后重新执行Release打包:

./gradlew assembleRelease

4. 验证Zoom SDK集成完整性

确认升级到1.5.3时,已完全替换android/mobilertc目录下的所有旧版本文件,避免新旧文件混合导致的依赖冲突。同时检查package.json中相关封装库(如react-native-zoom-us)的版本是否适配Zoom SDK 1.5.3。

5. 调整Dex合并参数

在app/build.gradle的android块中添加Dex合并优化配置:

android {
    defaultConfig {
        // 保留原有配置
        multiDexEnabled true
    }
    dexOptions {
        preDexLibraries = false
        javaMaxHeapSize "4g"
    }
}

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.03 18:01:09