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

一个人想着一个人 提交于 2019-12-08 04:55:22

问题


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?


回答1:


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.




回答2:


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'


来源:https://stackoverflow.com/questions/52990071/failed-to-resolve-com-google-firebasefirebase-crash17-0-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!