uni-app打包时报错:Execution failed for task ':app:checkReleaseDuplicateClasses'

uni-app是常见多端框架之一,在开发中遇到各类问题是在所难免的存在。

本篇文章来记录下在打包过程中遇到的如下问题。

uni-app进行app打包时报错,错误信息如下:

FAILURE: Build completed with 2 failures.
1: Task 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 cn.com.chinatelecom.account.a.a found in modules jetified-gysdk-3.1.0.0-runtime (gysdk-3.1.0.0.aar) and jetified-quicklogin-3.3.3.1-runtime (quicklogin-3.3.3.1.aar)
Duplicate class cn.com.chinatelecom.account.a.b found in modules jetified-gysdk-3.1.0.0-runtime (gysdk-3.1.0.0.aar) and jetified-quicklogin-3.3.3.1-runtime (quicklogin-3.3.3.1.aar)
Duplicate class cn.com.chinatelecom.account.a.c found in modules jetified-gysdk-3.1.0.0-runtime (gysdk-3.1.0.0.aar) and jetified-quicklogin-3.3.3.1-runtime (quicklogin-3.3.3.1.aar)
Duplicate class cn.com.chinatelecom.account.a.c$1 found in modules jetified-gysdk-3.1.0.0-runtime (gysdk-3.1.0.0.aar) and jetified-quicklogin-3.3.3.1-runtime (quicklogin-3.3.3.1.aar)
Duplicate class cn.com.chinatelecom.account.api.ClientUtils found in modules jetified-gysdk-3.1.0.0-runtime (gysdk-3.1.0.0.aar) and jetified-quicklogin-3.3.3.1-runtime (quicklogin-3.3.3.1.aar)
Duplicate class cn.com.chinatelecom.account.api.CtAccountJsBridge found in modules jetified-gysdk-3.1.0.0-runtime (gysdk-3.1.0.0.aar) and jetified-quicklogin-3.3.3.1-runtime (quicklogin-3.3.3.1.aar)
Duplicate class cn.com.chinatelecom.account.api.CtAccountJsBridge$1 found in modules jetified-gysdk-3.1.0.0-runtime (gysdk-3.1.0.0.aar) and jetified-quicklogin-3.3.3.1-runtime (quicklogin-3.3.3.1.aar)
Duplicate class cn.com.chinatelecom.account.api.CtAccountJsBridge$2 found in modules jetified-gysdk-3.1.0.0-runtime (gysdk-3.1.0.0.aar) and jetified-quicklogin-3.3.3.1-runtime (quicklogin-3.3.3.1.aar)
Duplicate class cn.com.chinatelecom.account.api.CtAccountJsBridge$a found in modules jetified-gysdk-3.1.0.0-runtime (gysdk-3.1.0.0.aar) and jetified-quicklogin-3.3.3.1-runtime (quicklogin-3.3.3.1.aar)
Duplicate class cn.com.chinatelecom.account.api.CtAuth found in modules jetified-gysdk-3.1.0.0-runtime (gysdk-3.1.0.0.aar) and jetified-quicklogin-3.3.3.1-runtime (quicklogin-3.3.3.1.aar)
Duplicate class cn.com.chinatelecom.account.api.CtAuth$1 found in modules jetified-gysdk-3.1.0.0-runtime (gysdk-3.1.0.0.aar) and jetified-quicklogin-3.3.3.1-runtime (quicklogin-3.3.3.1.aar)
Duplicate class cn.com.chinatelecom.account.api.CtSetting found in modules jetified-gysdk-3.1.0.0-runtime (gysdk-3.1.0.0.aar) and jetified-quicklogin-3.3.3.1-runtime (quicklogin-3.3.3.1.aar)
Duplicate class cn.com.chinatelecom.account.api.Helper found in modules jetified-gysdk-3.1.0.0-runtime (gysdk-3.1.0.0.aar) and jetified-quicklogin-3.3.3.1-runtime (quicklogin-3.3.3.1.aar)
Duplicate class cn.com.chinatelecom.account.api.ResultListener found in modules jetified-gysdk-3.1.0.0-runtime (gysdk-3.1.0.0.aar) and jetified-quicklogin-3.3.3.1-runtime (quicklogin-3.3.3.1.aar)
Duplicate class cn.com.chinatelecom.account.api.TraceLogger found in modules jetified-gysdk-3.1.0.0-runtime (gysdk-3.1.0.0.aar) and jetified-quicklogin-3.3.3.1-runtime (quicklogin-3.3.3.1.aar)
Duplicate class cn.com.chinatelecom.account.api.a found in modules jetified-gysdk-3.1.0.0-runtime (gysdk-3.1.0.0.aar) and jetified-quicklogin-3.3.3.1-runtime (quicklogin-3.3.3.1.aar)
Duplicate class cn.com.chinatelecom.account.api.a.a found in modules jetified-gysdk-3.1.0.0-runtime (gysdk-3.1.0.0.aar) and jetified-quicklogin-3.3.3.1-runtime (quicklogin-3.3.3.1.aar)
Duplicate class cn.com.chinatelecom.account.api.a.b found in modules jetified-gysdk-3.1.0.0-runtime (gysdk-3.1.0.0.aar) and jetified-quicklogin-3.3.3.1-runtime (quicklogin-3.3.3.1.aar)
Duplicate class cn.com.chinatelecom.account.api.a.c found in modules jetified-gysdk-3.1.0.0-runtime (gysdk-3.1.0.0.aar) and jetified-quicklogin-3.3.3.1-runtime (quicklogin-3.3.3.1.aar)
Duplicate class cn.com.chinatelecom.account.api.a.d found in modules jetified-gysdk-3.1.0.0-runtime (gysdk-3.1.0.0.aar) and jetified-quicklogin-3.3.3.1-runtime (quicklogin-3.3.3.1.aar)

错误分析:

Execution failed for task ':app:checkReleaseDuplicateClasses'.

从这一句可以知道是app中有个什么类重复了,简而言之就是存在重复的东西。

接着向下看,可以看出下面这句给出了明确的提示

Duplicate class cn.com.chinatelecom.account.a.a found in modules jetified-gysdk-3.1.0.0-runtime (gysdk-3.1.0.0.aar) and jetified-quicklogin-3.3.3.1-runtime (quicklogin-3.3.3.1.aar)

即gysdk和quicklogin两个类就是重复项,知道了重复项就需要知道他们是做什么的?

gysdk为第三方一键登录插件、quicklogin为uni-app官方提供的一键登录插件。

知道了两个都是一键登录使用的,那么只需要将其中一个取消掉即可。

易盾一键登录关闭,如图位置将易盾插件删除即可。


uni-app一键登录

如图,登录鉴权模块中一键登录取消选中即可。


六月初字帖坊小程序 你想要的字帖模板及工具,这里都有!