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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With