【发布时间】:2020-12-13 02:26:00
【问题描述】:
我的应用程序中有不同的模块遵循干净的架构,一些是纯 kotlin 模块和其他 android 模块,但是当我尝试编译应用程序时,我得到了重复的类错误。
* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
> Duplicate class dagger.hilt.codegen.OriginatingElement found in modules jetified-hilt-android-2.28.3-alpha-runtime (com.google.dagger:hilt-android:2.28.3-alpha) and jetified-hilt-android-compiler-2.28.3-alpha (com.google.dagger:hilt-android-compiler:2.28.3-alpha)
Duplicate class dagger.hilt.processor.internal.aggregateddeps.AggregatedDeps found in modules jetified-hilt-android-2.28.3-alpha-runtime (com.google.dagger:hilt-android:2.28.3-alpha) and jetified-hilt-android-compiler-2.28.3-alpha (com.google.dagger:hilt-android-compiler:2.28.3-alpha)
Duplicate class dagger.shaded.auto.common.AnnotationMirrors found in the following modules: jetified-dagger-compiler-2.28.3 (com.google.dagger:dagger-compiler:2.28.3), jetified-dagger-spi-2.28.3 (com.google.dagger:dagger-spi:2.28.3) and jetified-hilt-android-compiler-2.28.3-alpha (com.google.dagger:hilt-android-compiler:2.28.3-alpha)
Duplicate class dagger.shaded.auto.common.AnnotationMirrors$1 found in the following modules: jetified-dagger-compiler-2.28.3 (com.google.dagger:dagger-compiler:2.28.3), jetified-dagger-spi-2.28.3 (com.google.dagger:dagger-spi:2.28.3) and jetified-hilt-android-compiler-2.28.3-alpha (com.google.dagger:hilt-android-compiler:2.28.3-alpha)
Duplicate class dagger.shaded.auto.common.AnnotationMirrors$2 found in the following modules: jetified-dagger-compiler-2.28.3 (com.google.dagger:dagger-compiler:2.28.3), jetified-dagger-spi-2.28.3 (com.google.dagger:dagger-spi:2.28.3) and jetified-hilt-android-compiler-2.28.3-alpha (com.google.dagger:hilt-android-compiler:2.28.3-alpha)
Duplicate class dagger.shaded.auto.common.AnnotationValues found in the following modules: jetified-dagger-compiler-2.28.3 (com.google.dagger:dagger-compiler:2.28.3), jetified-dagger-spi-2.28.3 (com.google.dagger:dagger-spi:2.28.3) and jetified-hilt-android-compiler-2.28.3-alpha (com.google.dagger:hilt-android-compiler:2.28.3-alpha)
Duplicate class dagger.shaded.auto.common.AnnotationValues$1 found in the following modules: jetified-dagger-compiler-2.28.3 (com.google.dagger:dagger-compiler:2.28.3), jetified-dagger-spi-2.28.3 (com.google.dagger:dagger-spi:2.28.3) and jetified-hilt-android-compiler-2.28.3-alpha (com.google.dagger:hilt-android-compiler:2.28.3-alpha)
Duplicate class dagger.shaded.auto.common.AnnotationValues$1$1 found in the following modules: jetified-dagger-compiler-2.28.3 (com.google.dagger:dagger-compiler:2.28.3), jetified-dagger-spi-2.28.3 (com.google.dagger:dagger-spi:2.28.3) and jetified-hilt-android-compiler-2.28.3-alpha (com.google.dagger:hilt-android-compiler:2.28.3-alpha)
Duplicate class dagger.shaded.auto.common.AnnotationValues$1$1$1 found in the following modules: jetified-dagger-compiler-2.28.3 (com.google.dagger:dagger-compiler:2.28.3), jetified-dagger-spi-2.28.3 (com.google.dagger:dagger-spi:2.28.3) and jetified-hilt-android-compiler-2.28.3-alpha (com.google.dagger:hilt-android-compiler:2.28.3-alpha)
Duplicate class dagger.shaded.auto.common.AnnotationValues$1$1$2 found in the following modules: jetified-dagger-compiler-2.28.3 (com.google.dagger:dagger-compiler:2.28.3), jetified-dagger-spi-2.28.3 (com.google.dagger:dagger-spi:2.28.3) and jetified-hilt-android-compiler-2.28.3-alpha (com.google.dagger:hilt-android-compiler:2.28.3-alpha)
Duplicate class dagger.shaded.auto.common.AnnotationValues$1$1$3 found in the following modules: jetified-dagger-compiler-2.28.3 (com.google.dagger:dagger-compiler:2.28.3), jetified-dagger-spi-2.28.3 (com.google.dagger:dagger-spi:2.28.3) and jetified-hilt-android-compiler-2.28.3-alpha (com.google.dagger:hilt-android-compiler:2.28.3-alpha)
Duplicate class dagger.shaded.auto.common.AnnotationValues$1$1$4 found in the following modules: jetified-dagger-compiler-2.28.3 (com.google.dagger:dagger-compiler:2.28.3), jetified-dagger-spi-2.28.3 (com.google.dagger:dagger-spi:2.28.3) and jetified-hilt-android-compiler-2.28.3-alpha (com.google.dagger:hilt-android-compiler:2.28.3-alpha)
Duplicate class dagger.shaded.auto.common.AnnotationValues$1$2 found in the following modules: jetified-dagger-compiler-2.28.3 (com.google.dagger:dagger-compiler:2.28.3), jetified-dagger-spi-2.28.3 (com.google.dagger:dagger-spi:2.28.3) and jetified-hilt-android-compiler-2.28.3-alpha (com.google.dagger:hilt-android-compiler:2.28.3-alpha)
Duplicate class dagger.shaded.auto.common.BasicAnnotationProcessor found in the following modules: jetified-dagger-compiler-2.28.3 (com.google.dagger:dagger-compiler:2.28.3), jetified-dagger-spi-2.28.3 (com.google.dagger:dagger-spi:2.28.3) and jetified-hilt-android-compiler-2.28.3-alpha (com.google.dagger:hilt-android-compiler:2.28.3-alpha)
Duplicate class dagger.shaded.auto.common.BasicAnnotationProcessor$1 found in the following modules: jetified-dagger-compiler-2.28.3 (com.google.dagger:dagger-compiler:2.28.3), jetified-dagger-spi-2.28.3 (com.google.dagger:dagger-spi:2.28.3) and jetified-hilt-android-compiler-2.28.3-alpha (com.google.dagger:hilt-android-compiler:2.28.3-alpha)
Duplicate class dagger.shaded.auto.common.BasicAnnotationProcessor$2 found in the following modules: jetified-dagger-compiler-2.28.3 (com.google.dagger:dagger-compiler:2.28.3), jetified-dagger-spi-2.28.3 (com.google.dagger:dagger-spi:2.28.3) and jetified-hilt-android-compiler-2.28.3-alpha (com.google.dagger:hilt-android-compiler:2.28.3-alpha)
Duplicate class dagger.shaded.auto.common.BasicAnnotationProcessor$ElementName found in the following modules: jetified-dagger-compiler-2.28.3 (com.google.dagger:dagger-compiler:2.28.3), jetified-dagger-spi-2.28.3 (com.google.dagger:dagger-spi:2.28.3) and jetified-hilt-android-compiler-2.28.3-alpha (com.google.dagger:hilt-android-compiler:2.28.3-alpha)```
【问题讨论】:
-
没有你的 Gradle 文件是不清楚的。看起来你这里有一些重复的依赖项
标签: android kotlin dagger clean-architecture dagger-hilt