错误解决方案
错误描述:App原生语言插件/uts插件 依赖的三方库冲突
解决方案:请根据错误信息修改App原生语言插件/uts插件 依赖的三方库或联系插件作者解决。
FAlLURE: Build failed with an exception,
*what went wrong
Execution failed for task'app:checkReleaseDuplicateClasses'
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
Duplicate class com.google.android.datatransport.AutoValue_Eventfound in modules transport-api-2.2.1.aar-> jetified-transport-api-2.2.1-runtime(com.google.android.datatransport:transport-api:2.2.1)and transport-api-3.0.0.aar->jetified-transport-
api-3.0.0-runtime(transport-api-3.0.0.aar
Duplicate class com.google.android.datatransport.BuildConfig found in modules transport-api-2.2.1.aar->jetified-transport-api-2.2.1-runtime(com.google.android.datatransport:transport-api:2.2.1) and transport-api-3.0.0.aar->jetified-transport-api-
3.0.0-runtime(transport-api-3.0.0.aar)
Duplicate class com.google.android.datatransport.Encodingfound in modules transport-api-2.2.1.aar->jetified-transport-api_2.2.1-runtime(com.google.android.datatransport:transport-api:2.2.1) and transport-api-3.0.0.aar->jetified-transport-api-3.0.0
runtime(transport-api-3.0.0.aar)
Duplicate class com.google.android.datatransport.Event found in modules transport-api-2.2.1.aar->jetified-transport-api_2.2.1-runtime(com.google.android.datatransport:transport-api:2.2.1) and transport-api-3.0.0.aar->jetified-transport-api-3.0.0
runtime(transport-api-3.0.0.aar)
Duplicate class com.google.android.datatransport.Priority found in modules transport-api-2.2.1.aar ->jetified-transport-api-2.2.1-runtime (com.google.android.datatransport:transport-api:2.2.1) and transport-api3.0.0.aar->jetified-transport-api-3.0.0
runtime(transport-api-3.0.0.aar
Duplicate class com.google.android.datatransport.Transformer found in modules transport-api-2.2.1.aar ->jetified-transport-api_2.2.1-runtime(com.google.android.datatransport:transport-api:2.2.1) and transport-api_3.0.0.aar ->jetified-transport-api-
1 个回复
Ask小助手 - Ask社区AI助手
问题定位
报错信息表明:
com.google.android.datatransport:transport-api的不同版本(2.2.1 与 3.0.0),导致类重复。checkReleaseDuplicateClasses阶段直接中止了构建。解决思路
具体步骤
方案 A:升级/降级插件,使两者使用同一版本
方案 B:在项目中强制指定版本(Gradle 依赖约束)
在
android/app/build.gradle(或 HBuilderX 生成的app-build.gradle)最外层加入:这样无论插件声明 2.2.1 还是 3.0.0,最终只保留 3.0.0。
方案 C:使用 android-exclude.txt 排除旧版本
若插件把 transport-api-2.2.1.aar 直接打进插件包,可在项目目录:
写入:
重新云打包即可让 2.2.1 不参与编译。
注意事项
NoClassDefFoundError,说明旧插件代码仍依赖 2.x API,需要插件作者适配 3.x。推荐做法
优先联系插件作者统一依赖版本,其次使用 resolutionStrategy 强制 3.0.0,最后才用 exclude 方案。
要回复问题请先登录或注册
公告
更多>相关问题