【问题标题】:Android Dependencies Error: Libraries must match the same versionAndroid 依赖项错误:库必须匹配相同的版本
【发布时间】:2023-04-01 04:51:01
【问题描述】:

如您所见,我认为所有支持库都有相同的版本,那么为什么会出现此错误?

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.google.firebase:firebase-core:15.0.0'
implementation 'com.google.firebase:firebase-auth:15.0.0'
implementation 'com.android.support:recyclerview-v7:27.1.1'

}

【问题讨论】:

标签: java android dependencies libraries


【解决方案1】:

我认为可能有两个原因:

1) 当您将鼠标悬停在错误上时,它可能会告诉您哪个库的版本错误,并且可能它甚至不存在于您的依赖项中,但可能您的某个库在内部使用它,因此您需要指定它们分别使用相同的版本。

2) 或者可能是因为其中一个库(它可能是 firebase)是针对不同版本的支持库编译的,这导致了冲突。所以你需要你的支持库来匹配 firebase 编译的支持库。例如看看 Glide 是如何解释的 here:

支持库版本 - Glide 使用支持库版本 27。

如果您需要或希望使用不同版本的支持库,您应该在 build.gradle 文件中从 Glide 依赖项中排除“com.android.support”。

所以要检查一下,如果你删除了 firebase 依赖项,它可能会构建。如果是这种情况,那么您需要检查您的 firebase 版本是针对哪个版本编译的并使用它。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-09-28
    • 1970-01-01
    • 1970-01-01
    • 2016-03-03
    • 1970-01-01
    • 1970-01-01
    • 2011-12-19
    • 1970-01-01
    相关资源
    最近更新 更多