android - Android Gradle依赖重复类错误
问题描述
将 Square 的 Reader SDK 安装到我的应用程序后,我在一些 Gradle 依赖项之间遇到了重复的类错误,如下所示。
- 我的应用程序模块依赖项:
dependencies {
def readerSdkVersion = "1.3.5"
implementation "com.squareup.sdk.reader:reader-sdk-$SQUARE_READER_SDK_APPLICATION_ID:$readerSdkVersion"
runtimeOnly ("com.squareup.sdk.reader:reader-sdk-internals:$readerSdkVersion") {
exclude group: 'com.squareup.phrase', module: 'phrase'
}
implementation 'com.squareup.phrase:phrase:1.1.0'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.multidex:multidex:2.0.1'
}
- ...即使我尝试从Square 的 Phrase 依赖项中排除冲突的组/模块,我也会遇到构建失败:
Duplicate class com.squareup.phrase.BuildConfig found in modules jetified-phrase-1.1.0.jar (com.squareup.phrase:phrase:1.1.0) and reader-sdk-internals-1.3.5.jar (com.squareup.sdk.reader:reader-sdk-internals:1.3.5)
Duplicate class com.squareup.phrase.ListPhrase found in modules jetified-phrase-1.1.0.jar (com.squareup.phrase:phrase:1.1.0) and reader-sdk-internals-1.3.5.jar (com.squareup.sdk.reader:reader-sdk-internals:1.3.5)
Duplicate class com.squareup.phrase.ListPhrase$1 found in modules jetified-phrase-1.1.0.jar (com.squareup.phrase:phrase:1.1.0) and reader-sdk-internals-1.3.5.jar (com.squareup.sdk.reader:reader-sdk-internals:1.3.5)
Duplicate class com.squareup.phrase.ListPhrase$Formatter found in modules jetified-phrase-1.1.0.jar (com.squareup.phrase:phrase:1.1.0) and reader-sdk-internals-1.3.5.jar (com.squareup.sdk.reader:reader-sdk-internals:1.3.5)
Duplicate class com.squareup.phrase.Phrase found in modules jetified-phrase-1.1.0.jar (com.squareup.phrase:phrase:1.1.0) and reader-sdk-internals-1.3.5.jar (com.squareup.sdk.reader:reader-sdk-internals:1.3.5)
Duplicate class com.squareup.phrase.Phrase$KeyToken found in modules jetified-phrase-1.1.0.jar (com.squareup.phrase:phrase:1.1.0) and reader-sdk-internals-1.3.5.jar (com.squareup.sdk.reader:reader-sdk-internals:1.3.5)
Duplicate class com.squareup.phrase.Phrase$LeftCurlyBracketToken found in modules jetified-phrase-1.1.0.jar (com.squareup.phrase:phrase:1.1.0) and reader-sdk-internals-1.3.5.jar (com.squareup.sdk.reader:reader-sdk-internals:1.3.5)
Duplicate class com.squareup.phrase.Phrase$TextToken found in modules jetified-phrase-1.1.0.jar (com.squareup.phrase:phrase:1.1.0) and reader-sdk-internals-1.3.5.jar (com.squareup.sdk.reader:reader-sdk-internals:1.3.5)
Duplicate class com.squareup.phrase.Phrase$Token found in modules jetified-phrase-1.1.0.jar (com.squareup.phrase:phrase:1.1.0) and reader-sdk-internals-1.3.5.jar (com.squareup.sdk.reader:reader-sdk-internals:1.3.5)
我在这里错过了什么吗?是的,我拥有前面提到的 SDK 文档中提到的所有其他 Gradle 配置(即 multidex 和编译选项集)。
解决方案
推荐阅读
- java - 无法在我的测试 gradle 中导入 mockito
- sql - 如何连接同一表中的 2 列
- ethereum - 如何在solidity中声明一个列出的变量?
- node.js - 在 fastify 中使用 node-http-proxy `Error: socket hang up`
- java - 如何按对象状态按降序对充满对象的集合进行排序?
- html - 为什么div重叠
- forms - 如何突出显示标签而不是无效的反馈 div
- spring - Spring WebClient:SSLEngine 已关闭
- angular - C# Angular 应用程序发布调用产生 400 错误请求
- python - 我如何使这个功能工作?我有一个指定流派的歌曲列表,我想显示最受欢迎的流派