所有 gms/firebase 库必须使用完全相同的版本.发现版本 15.1.0、15.0.2、15.0.1、15.0.0. [英] all gms/firebase libaries must use the exact same version. Found versions 15.1.0, 15.0.2, 15.0.1, 15.0.0.

查看:31
本文介绍了所有 gms/firebase 库必须使用完全相同的版本.发现版本 15.1.0、15.0.2、15.0.1、15.0.0.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试在我的项目中实施 Firebase.

Gradle 文件:

应用插件:'com.android.application'安卓 {compileSdkVersion 27默认配置{applicationId "com.ghaleh.myapplication"minSdk 版本 16目标SDK版本27版本代码 1版本名称1.0"testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"}构建类型{释放 {minifyEnabled falseproguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'}}}依赖{实现文件树(目录:'libs',包括:['*.jar'])实现 'com.android.support:appcompat-v7:27.1.1'实现 'com.android.support:support-media-compat:27.1.1'实现 'com.android.support:support-v4:27.1.1'testImplementation 'junit:junit:4.12'androidTestImplementation 'com.android.support.test:runner:1.0.2'androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'实现 'com.google.firebase:firebase-messaging:15.0.2'}应用插件:'com.google.gms.google-services'

我收到此错误:

所有 gms/firebase 库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃).发现版本 15.1.0、15.0.2、15.0.1、15.0.0.示例包括 com.google.firebase:firebase-iid:15.1.0 和 com.google.android.gms:play-services-measurement-base:15.0.2

根据 Google 的 Maven Repository 最新版本的 firebase-messaging 是 15.0.2,我收到 firebase-iid:15.1.0 的错误所以我无法将 firebase-messaging 升级到更高版本或实现 firebase-iid:15.1.0 以匹配版本.

我已经尝试过这里推荐的其他解决方案:123 但没有一个有用.

我也试过这个(但它似乎不是一个合适的解决方案):

实现('com.google.firebase:firebase-messaging:15.0.2'){排除组:com.google.android.gms"}

我收到此错误:

错误:任务':app:transformDexArchiveWithExternalLibsDexMergerForBazaarDebug'的执行失败.java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: 无法合并 dex

提前致谢.

解决方案

您需要更新 google-service 插件才能使用:

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

为了避免这些错误,也升级到android studio 3.1

<块引用>

如果您没有使用 Android Studio 3.1 来开发您的应用,您将需要升级才能在 IDE 中获得正确的版本检查行为.

更多信息和要遵循的步骤:

宣布新的 SDK 版本>

编译无法完成:程序类型已经存在:com.google.android.gms.internal.measurement.zzabn

Trying to implement Firebase in my project.

Gradle file:

apply plugin: 'com.android.application'

android {
compileSdkVersion 27
defaultConfig {
    applicationId "com.ghaleh.myapplication"
    minSdkVersion 16
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
     }


buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:support-media-compat:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-  core:3.0.2'
implementation 'com.google.firebase:firebase-messaging:15.0.2'
}
apply plugin: 'com.google.gms.google-services'

And I'm getting this error:

All gms/firebase libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 15.1.0, 15.0.2, 15.0.1, 15.0.0. Examples include com.google.firebase:firebase-iid:15.1.0 and com.google.android.gms:play-services-measurement-base:15.0.2

According to Google's Maven Repository the latest version of firebase-messaging is 15.0.2 and I'm getting error for firebase-iid:15.1.0 So I cannot upgrade the firebase-messaging to a higher version or implement the firebase-iid:15.1.0 to match the versions.

I've already tried other solutions recommended here: 1, 2, 3 but non of them were useful.

I've also tried this (however it doesn't seem to be a proper solution):

implementation ('com.google.firebase:firebase-messaging:15.0.2') {
    exclude group: "com.google.android.gms"
}

and I get this error:

Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForBazaarDebug'.
java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

Thanks in advance.

解决方案

You need to update google-service plugin to use:

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

to be able to avoid those errors, also upgrade to android studio 3.1

If you're not using Android Studio 3.1 to develop your app, you will need to upgrade in order to get the correct version checking behavior within the IDE.

more information and steps to follow:

Announcing new SDK versioning

Compilation failed to complete:Program type already present: com.google.android.gms.internal.measurement.zzabn

这篇关于所有 gms/firebase 库必须使用完全相同的版本.发现版本 15.1.0、15.0.2、15.0.1、15.0.0.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆