android - Gradle生成APK —条目名称 'META-INF/androidx.hilt_hilt-common.version'发生冲突

标签 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.gradle.internal.tasks.Workers$ActionFacade
   > Entry name 'META-INF/androidx.hilt_hilt-common.version' collided
更新:Ran应用程序:依赖项
+--- 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 (*)





最佳答案

乍一看,您的依赖项似乎有冲突-我怀疑您的项目中包含了2个不同版本的Hilt。
请运行Gradle :app:dependencies任务(或与您的项目结构相对应的任务),然后检查输出以验证可能导致冲突的原因(搜索“击中”条目)。

关于android - Gradle生成APK —条目名称 'META-INF/androidx.hilt_hilt-common.version'发生冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64562160/

相关文章:

android - 在 android 中存储 EditText 值

android - 如何在 Android 中使用 deepLink

android - Buck - 构建具有多种 Gradle 风格/构建类型和 list 的 Android 应用程序

android - 从Android的jacoco代码覆盖率中排除软件包

Android 应用向后兼容版本的 google play services API

Android getWifiState 转字符串

android - 有没有一种简单的方法可以提示用户选择他喜欢的通知音?

gradle - 无法通知构建监听器Gradle Artifactory插件

android - 不支持的方法 : InstantRun. getRestartDexFile() - Android Studio

android - 找不到Gradle DSL方法:testCompile()