重复类:javax.activation.使用Gradle构建项目时

hl0ma9xz  于 2023-08-06  发布在  Java
关注(0)|答案(3)|浏览(173)

在我的build.gradle文件中添加以下实现后,通过USB在我的手机上运行项目时,我得到了一个失败的构建:

implementation 'com.fasterxml.jackson.core:jackson-core:2.10.1'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.10.1'

字符串
但构建成功,无需在设备上运行。以下是Build输出中的重复文件:

Duplicate class javax.activation.ActivationDataFlavor found in modules jetified-activation (activation.jar) and jetified-jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1)
Duplicate class javax.activation.CommandInfo found in modules jetified-activation (activation.jar) and jetified-jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1)
Duplicate class javax.activation.CommandMap found in modules jetified-activation (activation.jar) and jetified-jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1)
Duplicate class javax.activation.CommandObject found in modules jetified-activation (activation.jar) and jetified-jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1)
Duplicate class javax.activation.DataContentHandler found in modules jetified-activation (activation.jar) and jetified-jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1)
Duplicate class javax.activation.DataContentHandlerFactory found in modules jetified-activation (activation.jar) and jetified-jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1)
Duplicate class javax.activation.DataHandler found in modules jetified-activation (activation.jar) and jetified-jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1)
Duplicate class javax.activation.DataHandler$1 found in modules jetified-activation (activation.jar) and jetified-jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1)
Duplicate class javax.activation.DataHandlerDataSource found in modules jetified-activation (activation.jar) and jetified-jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1)
Duplicate class javax.activation.DataSource found in modules jetified-activation (activation.jar) and jetified-jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1)
Duplicate class javax.activation.DataSourceDataContentHandler found in modules jetified-activation (activation.jar) and jetified-jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1)
Duplicate class javax.activation.FileDataSource found in modules jetified-activation (activation.jar) and jetified-jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1)
Duplicate class javax.activation.FileTypeMap found in modules jetified-activation (activation.jar) and jetified-jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1)
Duplicate class javax.activation.MailcapCommandMap found in modules jetified-activation (activation.jar) and jetified-jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1)
Duplicate class javax.activation.MimeType found in modules jetified-activation (activation.jar) and jetified-jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1)
Duplicate class javax.activation.MimeTypeParameterList found in modules jetified-activation (activation.jar) and jetified-jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1)
Duplicate class javax.activation.MimeTypeParseException found in modules jetified-activation (activation.jar) and jetified-jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1)
Duplicate class javax.activation.MimetypesFileTypeMap found in modules jetified-activation (activation.jar) and jetified-jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1)
Duplicate class javax.activation.ObjectDataContentHandler found in modules jetified-activation (activation.jar) and jetified-jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1)
Duplicate class javax.activation.SecuritySupport found in modules jetified-activation (activation.jar) and jetified-jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1)
Duplicate class javax.activation.SecuritySupport$1 found in modules jetified-activation (activation.jar) and jetified-jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1)
Duplicate class javax.activation.SecuritySupport$2 found in modules jetified-activation (activation.jar) and jetified-jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1)
Duplicate class javax.activation.SecuritySupport$3 found in modules jetified-activation (activation.jar) and jetified-jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1)
Duplicate class javax.activation.SecuritySupport$4 found in modules jetified-activation (activation.jar) and jetified-jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1)
Duplicate class javax.activation.SecuritySupport$5 found in modules jetified-activation (activation.jar) and jetified-jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1)
Duplicate class javax.activation.URLDataSource found in modules jetified-activation (activation.jar) and jetified-jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1)
Duplicate class javax.activation.UnsupportedDataTypeException found in modules jetified-activation (activation.jar) and jetified-jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1)

mlnl4t2r

mlnl4t2r1#

在我的情况下,这是因为安全导航参数依赖。因此,请尝试删除依赖项并检查是哪一个导致了问题。

wgx48brx

wgx48brx2#

这可能是因为你使用了两个使用相同依赖项的库,尝试将transitive = true添加到Jackson,因为看起来你使用的是一个使用javax.activation的jakarta。
transtive是做什么的?检查这个帖子。
What does transitive = true in Gradle exactly do (w.r.t. crashlytics)?

pw136qt2

pw136qt23#

我可以通过注解id(“Kotlin”)找到问题

相关问题