Achraf Tech
Achraf Tech

Reputation: 11

Conflicts in gms/firebase libraries in android gradle dependencies

I have a conflict in com.google.android.gms:play-services-ads:15.0.1.

The error I am getting is:

All gms/firebase libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 16.0.1, 16.0.0, 15.0.4, 15.0.1, 15.0.0. Examples include com.google.firebase:firebase-database:16.0.1 and com.google.firebase:firebase-analytics:16.0.0 more... (Ctrl+F1)

This is my gradle settings:

implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:support-media-compat:27.1.1'
implementation 'com.android.support:customtabs:27.1.1'

implementation 'com.google.android.gms:play-services-ads:15.0.1'
implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-database:16.0.1'

implementation 'com.firebaseui:firebase-ui-database:3.3.1'
implementation 'com.firebaseui:firebase-ui-storage:3.3.1'

implementation 'com.github.bumptech.glide:glide:4.7.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'

implementation 'com.google.android.exoplayer:exoplayer:2.8.0'
implementation 'com.google.android.exoplayer:extension-rtmp:2.8.0'
implementation 'com.google.android.exoplayer:extension-mediasession:2.8.0'

implementation 'org.greenrobot:eventbus:3.0.0'
implementation 'io.github.kobakei:ratethisapp:1.1.1'
testImplementation 'junit:junit:4.12'

implementation('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') {
    transitive = true
}
}
// Firebase plugin
apply plugin: 'com.google.gms.google-services'

More information:

android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
    applicationId 'com.example.home.radio'
    minSdkVersion 21
    targetSdkVersion 27
    versionCode 49
    versionName "2.4.1"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

More informations:

buildscript {
repositories {
    jcenter()
    mavenCentral()
    google()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.1.2'
    classpath 'com.google.gms:google-services:4.0.1'
    classpath 'com.novoda:bintray-release:0.5.0'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

I downloaded a project from firebase website, and i found exactly the same problem, i think the problem is from firebase end.

Upvotes: 1

Views: 1564

Answers (2)

evals
evals

Reputation: 1869

make sure you are using most suitable versions(not necessary the same version number)- read this https://developers.google.com/android/guides/setup

//like this(for example)
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-core:16.0.0'

Upvotes: 0

chaunv
chaunv

Reputation: 843

Add explicitly the library with the old version but with a new version number. And: don't forget to press sync now so gradle can rebuild the dependency graph and see if there are any more conflicts.

For your case, you can try change:

implementation 'com.google.android.gms:play-services-ads:15.0.0'
implementation 'com.google.firebase:firebase-core:15.0.0'
implementation 'com.google.firebase:firebase-database:15.0.0'

to

implementation 'com.google.android.gms:play-services-ads:15.0.1'
implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-database:16.0.1'

Upvotes: 0

Related Questions