所有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.

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

问题描述

尝试在我的项目中实现Firebase。
$ b

Gradle文件:

  apply plugin:'com.android.application'

android {
compileSdkVersion 27
defaultConfig {
applicationIdcom.ghaleh.myapplication
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName1.0
testInstrumentationRunnerandroid.support.test.runner.AndroidJUnitRunner
}


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




$ b $'$'$'$'$ $ $ $ $ $ $ $ $ $ $ $ $'$'$'$' .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'
testImpl ementation'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'

我遇到这个错误:

 所有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存储库最新版本的 firebase-messaging 是15.0.2,我得到的错误firebase -id:15.1.0
所以我无法将 firebase-messaging 升级到更高版本或者实现 firebase -id:15.1。 0 来匹配版本。



我已经尝试了其他解决方案,推荐这里: 1 2 3 ,但其中没有一个是有用的。



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

  implementation('com.google.firebase:firebase -messaging:15.0.2'){
exclude group: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版本

< a href =https://stackoverflow.com/questions/50149266/compilation-failed-to-comple编译未能完成:程序类型已经存在: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天全站免登陆