首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >添加discord4j库后的分级错误

添加discord4j库后的分级错误
EN

Stack Overflow用户
提问于 2022-03-08 04:34:20
回答 1查看 213关注 0票数 2

我正试图与discord4j建立一个不和谐的机器人。我将这一行代码添加到build.gradle文件中。

代码语言:javascript
复制
dependencies {
    implementation "com.discord4j:discord4j-core:3.2.2"
}

但是,在我尝试构建应用程序之后,构建在任务:app:checkDebugDuplicateClasses上失败了。

代码语言:javascript
复制
* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
   > Duplicate class com.iwebpp.crypto.TweetNaclFast found in modules discord4j-rest-3.2 (com.discord4j:discord4j-rest:3.2.2) and discord4j-voice-3.2 (com.discord4j:discord4j-voice:3.2.2)
     Duplicate class com.iwebpp.crypto.TweetNaclFast$Box found in modules discord4j-rest-3.2 (com.discord4j:discord4j-rest:3.2.2) and discord4j-voice-3.2 (com.discord4j:discord4j-voice:3.2.2)
     Duplicate class com.iwebpp.crypto.TweetNaclFast$Box$KeyPair found in modules discord4j-rest-3.2 (com.discord4j:discord4j-rest:3.2.2) and discord4j-voice-3.2 (com.discord4j:discord4j-voice:3.2.2)
     Duplicate class com.iwebpp.crypto.TweetNaclFast$Hash found in modules discord4j-rest-3.2 (com.discord4j:discord4j-rest:3.2.2) and discord4j-voice-3.2 (com.discord4j:discord4j-voice:3.2.2)
     Duplicate class com.iwebpp.crypto.TweetNaclFast$ScalarMult found in modules discord4j-rest-3.2 (com.discord4j:discord4j-rest:3.2.2) and discord4j-voice-3.2 (com.discord4j:discord4j-voice:3.2.2)
     Duplicate class com.iwebpp.crypto.TweetNaclFast$SecretBox found in modules discord4j-rest-3.2 (com.discord4j:discord4j-rest:3.2.2) and discord4j-voice-3.2 (com.discord4j:discord4j-voice:3.2.2)
     Duplicate class com.iwebpp.crypto.TweetNaclFast$Signature found in modules discord4j-rest-3.2 (com.discord4j:discord4j-rest:3.2.2) and discord4j-voice-3.2 (com.discord4j:discord4j-voice:3.2.2)
     Duplicate class com.iwebpp.crypto.TweetNaclFast$Signature$KeyPair found in modules discord4j-rest-3.2 (com.discord4j:discord4j-rest:3.2.2) and discord4j-voice-3.2 (com.discord4j:discord4j-voice:3.2.2)
     Duplicate class com.iwebpp.crypto.TweetNaclFast$poly1305 found in modules discord4j-rest-3.2 (com.discord4j:discord4j-rest:3.2.2) and discord4j-voice-3.2 (com.discord4j:discord4j-voice:3.2.2)
     
     Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:checkDebugDuplicateClasses'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:188)
    at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:282)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:186)
    at ...
    
Caused by: org.gradle.workers.internal.DefaultWorkerExecutor$WorkExecutionException: A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
    at org.gradle.workers.internal.DefaultWorkerExecutor$WorkItemExecution.waitForCompletion(DefaultWorkerExecutor.java:342)
    at org.gradle.internal.work.DefaultAsyncWorkTracker.waitForItemsAndGatherFailures(DefaultAsyncWorkTracker.java:142)
    at org.gradle.internal.work.DefaultAsyncWorkTracker.waitForItemsAndGatherFailures(DefaultAsyncWorkTracker.java:94)
    at ...
    
Caused by: java.lang.RuntimeException: Duplicate class com.iwebpp.crypto.TweetNaclFast found in modules discord4j-rest-3.2 (com.discord4j:discord4j-rest:3.2.2) and discord4j-voice-3.2 (com.discord4j:discord4j-voice:3.2.2)
Duplicate class com.iwebpp.crypto.TweetNaclFast$Box found in modules discord4j-rest-3.2 (com.discord4j:discord4j-rest:3.2.2) and discord4j-voice-3.2 (com.discord4j:discord4j-voice:3.2.2)
Duplicate class com.iwebpp.crypto.TweetNaclFast$Box$KeyPair found in modules discord4j-rest-3.2 (com.discord4j:discord4j-rest:3.2.2) and discord4j-voice-3.2 (com.discord4j:discord4j-voice:3.2.2)
Duplicate class com.iwebpp.crypto.TweetNaclFast$Hash found in modules discord4j-rest-3.2 (com.discord4j:discord4j-rest:3.2.2) and discord4j-voice-3.2 (com.discord4j:discord4j-voice:3.2.2)
Duplicate class com.iwebpp.crypto.TweetNaclFast$ScalarMult found in modules discord4j-rest-3.2 (com.discord4j:discord4j-rest:3.2.2) and discord4j-voice-3.2 (com.discord4j:discord4j-voice:3.2.2)
Duplicate class com.iwebpp.crypto.TweetNaclFast$SecretBox found in modules discord4j-rest-3.2 (com.discord4j:discord4j-rest:3.2.2) and discord4j-voice-3.2 (com.discord4j:discord4j-voice:3.2.2)
Duplicate class com.iwebpp.crypto.TweetNaclFast$Signature found in modules discord4j-rest-3.2 (com.discord4j:discord4j-rest:3.2.2) and discord4j-voice-3.2 (com.discord4j:discord4j-voice:3.2.2)
Duplicate class com.iwebpp.crypto.TweetNaclFast$Signature$KeyPair found in modules discord4j-rest-3.2 (com.discord4j:discord4j-rest:3.2.2) and discord4j-voice-3.2 (com.discord4j:discord4j-voice:3.2.2)
Duplicate class com.iwebpp.crypto.TweetNaclFast$poly1305 found in modules discord4j-rest-3.2 (com.discord4j:discord4j-rest:3.2.2) and discord4j-voice-3.2 (com.discord4j:discord4j-voice:3.2.2)

Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.
    at com.android.build.gradle.internal.tasks.CheckDuplicateClassesDelegate.run(CheckDuplicateClassesDelegate.kt:71)
    at com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable.execute(CheckDuplicateClassesDelegate.kt:98)
    at ...


* Get more help at https://help.gradle.org

BUILD FAILED in 6s

我注意到在模块discord4j-restdiscord4j-voice中有一个重复的类。在寻找解决方案之后,我找到了这个答案

有时重复的类异常意味着您的依赖项之一隐式地使用您也在项目中使用的某个库的旧版本或更新版本(with +),

然而,这两个模块是discord4j的依赖项。因此,我无法与它们一起使用force函数。我该如何解决这个问题?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-03-09 21:13:20

我是Discord4J的开发人员之一,让推修将受影响的类移动到共享模块。

在出现包含它的稳定版本之前,您可以切换到最新的快照来尝试它。

代码语言:javascript
复制
repositories {
  maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
  mavenCentral()
}

dependencies {
  implementation 'com.discord4j:discord4j-core:3.2.3-SNAPSHOT'
}

来自:https://docs.discord4j.com/using-snapshots/

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71390070

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档