小编let*_*ebe的帖子

如何解决这个错误 - Duplicate class error Dagger Hilt?

我的应用程序中有不同的模块遵循干净的架构,有些是纯 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 …
Run Code Online (Sandbox Code Playgroud)

android kotlin dagger clean-architecture dagger-hilt

1
推荐指数
1
解决办法
1892
查看次数