Gradle生成APK——条目名称';META-INF/androidx.hilt_hilt-common.version';碰撞

Gradle生成APK——条目名称';META-INF/androidx.hilt_hilt-common.version';碰撞,android,gradle,android-gradle-plugin,build.gradle,Android,Gradle,Android Gradle Plugin,Build.gradle,在生成APK时,我突然遇到了这个构建问题。我不知道这意味着什么,也不知道如何解决。我在上一次构建时所做的更改非常小,甚至没有运气就恢复到了上一个版本。请协助: FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:packageStaging'. > A failure occurred while executing com.android.build.gr

在生成APK时,我突然遇到了这个构建问题。我不知道这意味着什么,也不知道如何解决。我在上一次构建时所做的更改非常小,甚至没有运气就恢复到了上一个版本。请协助:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:packageStaging'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > Entry name 'META-INF/androidx.hilt_hilt-common.version' collided
更新:运行应用程序:依赖项

+--- androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha02
|    +--- androidx.annotation:annotation:1.1.0
|    +--- androidx.hilt:hilt-common:1.0.0-alpha02
|    +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.2.0 (*)
|    \--- com.google.dagger:hilt-android:2.28-alpha (*)


+--- com.google.dagger:hilt-android:{strictly 2.28-alpha} -> 2.28-alpha (c)

+--- androidx.hilt:hilt-common:{strictly 1.0.0-alpha02} -> 1.0.0-alpha02 (c)

+--- com.google.dagger:hilt-android:2.28-alpha
|    +--- com.google.dagger:dagger:2.28
|    |    \--- javax.inject:javax.inject:1
|    +--- com.google.dagger:dagger-lint-aar:2.28
|    +--- com.google.code.findbugs:jsr305:3.0.1
|    +--- androidx.activity:activity:1.1.0
|    |    +--- androidx.annotation:annotation:1.1.0
|    |    +--- androidx.core:core:1.1.0 -> 1.3.0 (*)
|    |    +--- androidx.lifecycle:lifecycle-runtime:2.2.0 (*)
|    |    +--- androidx.lifecycle:lifecycle-viewmodel:2.2.0
|    |    |    \--- androidx.annotation:annotation:1.1.0
|    |    +--- androidx.savedstate:savedstate:1.0.0
|    |    |    +--- androidx.annotation:annotation:1.1.0
|    |    |    +--- androidx.arch.core:core-common:2.0.1 -> 2.1.0 (*)
|    |    |    \--- androidx.lifecycle:lifecycle-common:2.0.0 -> 2.2.0 (*)
|    |    \--- androidx.lifecycle:lifecycle-viewmodel-savedstate:1.0.0 -> 2.2.0
|    |         +--- androidx.annotation:annotation:1.0.0 -> 1.1.0
|    |         +--- androidx.savedstate:savedstate:1.0.0 (*)
|    |         +--- androidx.lifecycle:lifecycle-livedata-core:2.2.0
|    |         |    +--- androidx.lifecycle:lifecycle-common:2.2.0 (*)
|    |         |    +--- androidx.arch.core:core-common:2.1.0 (*)
|    |         |    \--- androidx.arch.core:core-runtime:2.1.0
|    |         |         +--- androidx.annotation:annotation:1.1.0
|    |         |         \--- androidx.arch.core:core-common:[2.1.0] -> 2.1.0 (*)
|    |         \--- androidx.lifecycle:lifecycle-viewmodel:2.2.0 (*)






乍一看,您的依赖关系似乎存在冲突——我怀疑您的项目中包含了两个不同版本的Hilt


请运行Gradle
:app:dependencies
任务(或与您的项目结构对应的任务),并检查输出以验证可能导致冲突的原因(搜索刀柄条目)。

结果表明我的情况是Android studio中的一个bug。我复制了“staging”并将其命名为“staging2”,效果很好。

我用有关刀柄的条目更新了帖子。对不起,我不知道事情是否有冲突。你能帮忙吗?看来这不是一个有效的方法。然而,我只是做了一个小调查,这看起来很相似:。我相信这会对你有所帮助。