Android Dependencies错误:库必须匹配相同的版本

时间:2018-04-29 09:42:41

标签: java android dependencies libraries

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

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'

}

1 个答案:

答案 0 :(得分:0)

我认为可能有两个原因:

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

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

  

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

     

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

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