【问题标题】:All gms/firebase libraries must use the exact same version specification (mixing versions can lead to runtime crashes)所有 gms/firebase 库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)
【发布时间】:2019-01-25 04:36:36
【问题描述】:

我已将 gms:play-services-analytics11.0.4 升级到 16.0.4firebase-messaging11.0.417.1.0lint 给出了这个错误

All gms/firebase libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 17.1.0, 16.2.0, 16.0.4, 16.0.3, 16.0.1, 16.0.0. Examples include `com.google.firebase:firebase-messaging:17.1.0` and `com.google.firebase:firebase-iid:16.2.0`

我查看了External libraries,我可以看到这里使用了不同版本的 gms。

com.google.android.gms:play-services-ads-identifier-16.0.0
com.google.android.gms:play-services-analytics-16.0.4
com.google.android.gms:play-services-analytics-impl-16.0.4
com.google.android.gms:play-services-base-16.0.1
com.google.android.gms:play-services-basement-16.0.1
com.google.android.gms:play-services-measurement-base-16.0.3

类似

com.google.firebase:firebase-common-16.0.0
com.google.firebase:firebase-iid-16.2.0
com.google.firebase:firebase-iid-interop-16.0.0
com.google.firebase:firebase-messaging-17.1.0

我只添加了以下两个依赖

implementation 'com.google.android.gms:play-services-analytics:16.0.4' implementation 'com.google.firebase:firebase-messaging:17.3.4'

根级别 build.gradle 包含

classpath 'com.google.gms:google-services:4.0.1'

如博客中所述 https://android-developers.googleblog.com/2018/05/announcing-new-sdk-versioning.html

现在所有 firebase/gms 库都可以有不同的版本控制,并且上面提到的库是由 android 本身导入的。 为什么我收到此错误?

【问题讨论】:

  • 您使用的是什么版本的 Android Studio、Gradle / Android Gradle 插件?更新到最新版本是否可以解决问题?将 google-services 插件也更新到最新版本怎么样?
  • @JustinHong 这是一个已知问题吗?我正在使用最新版本的 android studio 和 build-tools。似乎 android 在内部使用了这些不同版本的库,而 lint 也引发了同样的问题。

标签: firebase google-analytics google-play-services


【解决方案1】:

对我来说,它使用的是相当旧的构建工具版本。更新到构建工具 28.0.3 解决了这个问题。

【讨论】:

    猜你喜欢
    • 2019-07-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-14
    • 2018-10-10
    • 2018-08-12
    相关资源
    最近更新 更多