Ammar
Ammar

Reputation: 1821

Failed to resolve com.google.firebase:firebase-crash:17.0.2

I'm trying to implement a couple of features of Firebase as following;

implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-messaging:16.0.4'
implementation 'com.google.firebase:firebase-database:16.0.4'
implementation 'com.google.firebase:firebase-crash:16.0.4'

implementation 'com.google.android.gms:play-services-analytics:16.0.4'

The problem is that gradle sync is failing with following errors;

Failed to resolve: com.google.firebase:firebase-core:17.0.2

Failed to resolve: com.google.firebase:firebase-messaging:17.0.2

Failed to resolve: com.google.firebase:firebase-database:17.0.2

Failed to resolve: com.google.firebase:firebase-crash:17.0.2

Failed to resolve: com.google.android.gms:play-services-analytics:17.0.2

Failed to resolve: com.google.android.gms:play-services-location:17.0.2

Failed to resolve: com.google.android.gms:play-services-base:17.0.2

These errors are very confusing as no where in build.gradle I'm neither hitting 17.0.2 version of Firebase nor play services. Any clue?

Upvotes: 1

Views: 3342

Answers (2)

Novjean
Novjean

Reputation: 61

This is how I have wired it up. See if this helps.

    buildscript {
        repositories {
            google()
            maven {
                url 'https://maven.google.com/'
                name 'Google'
            }

            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.2.1'
            classpath 'com.google.gms:google-services:4.0.1'
        }
    }

    allprojects {
    repositories {
        google()
        jcenter()
    }
}

dependencies {

    //Firebase features
    implementation 'com.google.firebase:firebase-core:16.0.4'
    implementation 'com.google.firebase:firebase-config:16.1.0'
    implementation 'com.google.firebase:firebase-crash:16.2.1'
    implementation 'com.google.firebase:firebase-messaging:17.3.4'

    implementation('com.crashlytics.sdk.android:crashlytics:2.9.5@aar') {
        transitive = true
    }
    implementation('com.crashlytics.sdk.android:answers:1.4.1@aar') {
        transitive = true
}
}

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

Upvotes: 1

Doug Stevenson
Doug Stevenson

Reputation: 317352

You need to update your top-level build.gradle to use the latest version of the google services plugin. It looks like you're using a very old one that still assumes that all the Firebase and Play dependencies must be the same version, which is no longer the case.

classpath 'com.google.gms:google-services:4.1.0'

You should familiarize yourself with the latest integration instructions in the documentation, along with the latest versions of each dependency.

Also, you should stop using Firebase Crash Reporting and migrate to Crashlytics. Firebase Crash Reporting is decommissioned.

Upvotes: 2

Related Questions