user63762453
user63762453

Reputation: 1734

Error in building gradle - com.google.android.gms:play-services-basement is being requested by various other libraries

I am trying to integrate Facebook sign in feature to my android app using Firebase-UI library. I am following this tutorial - https://firebase.google.com/docs/auth/android/firebaseui?authuser=0

But I am getting below error while trying to build gradle:

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.

Below is my app level build.gradle file

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "company.com.mygame"
        minSdkVersion 15
        targetSdkVersion 28
        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:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'

    implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.0'

    implementation 'com.facebook.android:facebook-android-sdk:4.37.0'

    implementation 'com.google.firebase:firebase-core:16.0.4'
    implementation 'com.firebaseui:firebase-ui-auth:4.2.0'

    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'
}

apply plugin: 'com.google.gms.google-services'

I saw below links -

com.google.android.gms:play-services-measurement-base is being requested by various other libraries

https://github.com/OneSignal/OneSignal-Gradle-Plugin/issues/37

But then I get this error -

Manifest merger failed : uses-sdk:minSdkVersion 15 cannot be smaller than version 16 declared in library [com.firebaseui:firebase-ui-auth:4.2.0] C:\Users\me\.gradle\caches\transforms-1\files-1.1\firebase-ui-auth-4.2.0.aar\xxx\AndroidManifest.xml as the library might be using APIs not available in 15
    Suggestion: use a compatible library with a minSdk of at most 15,
        or increase this project's minSdk version to at least 16,
        or use tools:overrideLibrary="com.firebase.ui.auth" to force usage (may lead to runtime failures)

But the issue is still not fixed. I have just started learning android, not sure what am I missing.

Upvotes: 2

Views: 673

Answers (2)

tjungChaniago
tjungChaniago

Reputation: 196

I had the same issue

Just make sure that you have the latest versions of all the dependencies. I used the current versions for Firebase core and auth.

You can get the latest versions from here . Using the latest version at current point of time:

in app/build.gradle :

 dependencies {
    ...
    // Add these code
    implementation 'com.google.firebase:firebase-core:16.0.8'
    implementation 'com.google.firebase:firebase-auth:16.2.0'
 }

in android/build.gradle :

buildscript {
    ext {
        ...
        minSdkVersion = 16
        ...
    }
}

Upvotes: 2

Aashish
Aashish

Reputation: 39

Your error says : uses-sdk:minSdkVersion 15 cannot be smaller than version 16 and your build.gradle as minSdkVersion 15. Try to change it to 16 and see if that works for you.

All the best for learning android. May the force be with you.

Over and out,

Aashish

Upvotes: 1

Related Questions