Search code examples
androidfirebasegradleandroid-gradle-pluginfirebaseui

FirebaseUI import: The library com.google.android.gms:play-services-basement is being requested by various other libraries


I would want to add FirebaseUI dependecy in order to be able to authenticate my users using Google account, E-mail/Password authentication, etc.

Thus I added the dependency, as indicated in the documentation (https://firebase.google.com/docs/auth/android/firebaseui).

However, I get the following error.

The library com.google.android.gms:play-services-basement is being requested by various other libraries at [[15.0.1,15.0.1]], but resolves to 16.0.1. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.

The dependencies are:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.google.firebase:firebase-core:16.0.6'
    implementation 'com.google.firebase:firebase-firestore:17.1.5'
    implementation 'com.google.firebase:firebase-storage:16.0.5'
    implementation 'com.firebaseui:firebase-ui-auth:4.1.0'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.android.support:design: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.github.mancj:MaterialSearchBar:0.7.6'

    annotationProcessor 'com.google.auto.value:auto-value:1.5.2'
}

Question: How to fix this bug?


Solution

  • To solve this, please change the following line of code:

    implementation 'com.firebaseui:firebase-ui-auth:4.1.0'
    

    to

    implementation 'com.firebaseui:firebase-ui-auth:4.3.0'
    

    I would want to add FirebaseUI dependecy in order to be able to authenticate my users using Google account

    If you want to authenticate users using Google, you also should also add into your dependecies, the following lines of code:

    implementation 'com.google.firebase:firebase-auth:16.1.0'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'
    

    Please also make sure to have in your build.gradle (Project) file, the following versions for Gradle and Google Services:

    classpath 'com.android.tools.build:gradle:3.2.1'
    classpath 'com.google.gms:google-services:4.2.0'