我已将gms:play-services-analytics
从11.0.4
升级到16.0.4
和firebase-messaging
从11.0.4
到17.1.0
,但棉绒出现此错误
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
Similary
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本身导入。 为什么我收到此错误?
答案 0 :(得分:0)
对我来说,它使用的是较旧的构建工具版本。更新构建工具28.0.3解决了该问题。