Search code examples
androidfirebaseandroid-studiofirebase-cloud-messaginggoogle-play-services

Failed to resolve implementation 'com.google.firebase:firebase-messaging:15.0.2'


I am integrating Firebase messaging for a version. It is:

'com.google.firebase:firebase-messaging:15.0.2'

My classpath is:

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

I had faced the following error:

Failed to resolve: firebase-messaging Open File


Solution

  • Change this:

    classpath 'com.google.gms:google-services:3.2.0'
    implementation 'com.google.firebase:firebase-messaging:15.0.2'
    

    into this:

    classpath 'com.google.gms:google-services:4.0.1'
    implementation 'com.google.firebase:firebase-messaging:17.0.0'
    

    Explanation:

    Here in this case using firebase-messaging:15.0.2 with google-services:4.0.1 would work, since the most important thing was updating google-services above 3.2.0, and that's because google-services:3.3.0 is needed to be able to use the firebase library from version 15.0 and above. You can check this blog post. that explains the changes in versioning of firebase libraries.

    But it is still better to update the google-services plugin to prevent any other errors with other dependencies.

    Note:

    The versions less than 15.0.0 are in google maven repository, so you can use them in gradle. But, you cannot mix version 15.0.0 with a version less than 15.0.0 and use google play services 4.0.1, as said in my answer here. That's why it is better to update firebase libraries to the latest versions.