您的依赖之一是拥有不同版本的com.google.android.gms
.
Update
与过去不同,Firebase 依赖项具有独立版本。如果
您有版本冲突,那么您可以更新您的com.google.gms:google-services
。并开始定义独立
版本。
Update com.google.gms:google-services
转到顶部(项目)级别 build.gradle 并更新com.google.gms:google-services
到版本4.1.0
或更新版本(如果有) https://mvnrepository.com/artifact/com.google.gms/google-services?repo=bt-android-tools.
buildscript {
...
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath 'com.google.gms:google-services:4.1.0' //< update this
}
}
将 Firebase 依赖项更新为最新版本 https://firebase.google.com/support/release-notes/android
Firebase 依赖项版本可以是单独的。所以检查一下最新版本 https://firebase.google.com/support/release-notes/android.
com.google.firebase:firebase-core:16.0.3 //Analytics
com.google.firebase:firebase-database:16.0.2 //Realtime Database
原始解决方案(有用)
解决方法:
-
Exclude https://stackoverflow.com/a/36103326/6891563
com.google.android.gms
来自冲突的依赖。
- 更新该依赖项如果可供使用的话 https://firebase.google.com/support/release-notes/android.
- 改变你的
com.google.android.gms
版本为冲突版本。
Problem
如何查看正在使用哪个依赖项com.google.android.gms
?
1.通过命令解决
对于 Android,请使用此行
gradle app:dependencies
或者如果你有一个 gradle 包装器:
./gradlew app:dependencies
where app
是你的项目模块。
此外,如果您想检查某些内容是否存在compile
vs. testCompile
vs androidTestCompile
依赖性以及拉动它的因素:
./gradlew :app:dependencyInsight --configuration compile --dependency <name>
./gradlew :app:dependencyInsight --configuration testCompile --dependency <name>
./gradlew :app:dependencyInsight --configuration androidTestCompile --dependency <name>
2 使用这些插件
摇篮视图 https://github.com/rholder/gradle-view是一个 Android Studio 插件,您可以安装并显示依赖关系层次结构。方法计数 http://www.methodscount.com/plugins是另一个插件,它还显示依赖关系树。