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.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…