Ad

How To Solve Error Dependency Failing Adding Firebase Library

- 1 answer

I try to add the Firebase library to the project via instructions of firebase settings, but I get an error.

ERROR: In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[17.0.
0]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.

Dependency failing: com.google.android.gms:play-services-measurement-api:17.0.0 -> com.google.android.gms:play-services-
[email protected][17.0.0], but play-services-measurement-impl version was 17.0.1.

The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art
ifact with the issue.
-- Project 'app' depends onto com.google.firebase:[email protected]
-- Project 'app' depends onto com.google.android.gms:[email protected]
-- Project 'app' depends onto com.google.firebase:[email protected]{strictly 17.0.0}
-- Project 'app' depends onto com.google.android.gms:[email protected]{strictly 18.1.1}
-- Project 'app' depends onto com.google.android.gms:[email protected]
-- Project 'app' depends onto com.google.android.gms:[email protected]{strictly 18.1.1}
-- Project 'app' depends onto com.google.firebase:[email protected]{strictly 17.0.1}
-- Project 'app' depends onto com.google.android.gms:[email protected]
-- Project 'app' depends onto com.google.android.gms:[email protected]{strictly 17.0.1}
-- Project 'app' depends onto com.google.android.gms:[email protected]{strictly 17.0.0}
-- Project 'app' depends onto com.google.android.gms:[email protected]{strictly 17.0.1}
-- Project 'app' depends onto com.google.android.gms:[email protected]{strictly 17.0.1}

For extended debugging info execute Gradle from the command line with ./gradlew --info :app:assembleDebug to see the dep
endency paths to the artifact. This error message came from the google-services Gradle plugin, report issues at https://
github.com/google/play-services-plugins and disable by adding "googleServices { disableVersionCheck = false }" to your b
uild.gradle file.

The project build.gradle

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.2'
        classpath 'com.google.gms:google-services:4.3.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url "https://jitpack.io" }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

The app build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.project"
        minSdkVersion 18
        targetSdkVersion 28
        versionCode 17
        versionName "1.0.3"
        multiDexEnabled true
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    androidTestImplementation('androidx.test.espresso:espresso-core:3.1.1', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
    implementation 'com.google.android.material:material:1.1.0-alpha09'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.1.0-beta01'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.vectordrawable:vectordrawable:1.1.0-rc01'
    implementation 'androidx.preference:preference:1.1.0-rc01'
    implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'com.android.billingclient:billing:2.0.3'
    implementation 'com.google.android.gms:play-services-ads:18.1.1'
    implementation 'com.google.android.gms:play-services-measurement:17.0.1'
    implementation 'com.google.android.gms:play-services-measurement-sdk:17.0.1'
    implementation 'androidx.multidex:multidex:2.0.1'
    testImplementation 'junit:junit:4.12'

    implementation 'com.google.firebase:firebase-core:17.0.1'
}

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

How can solve this problem? I tried to find the same question, but nothing solved my problem.

Ad

Answer

I solved this problem by simply deleted following lines:

implementation 'com.google.android.gms:play-services-measurement:17.0.1'
implementation 'com.google.android.gms:play-services-measurement-sdk:17.0.1'
Ad
source: stackoverflow.com
Ad