Ir al contenido principal

How to solve Firebase "failed to resolve"

I spent 5 days trying to solve this simple error. If you try to add Firebase to your project through Android Studio Firebase menu, you may have this problem.

DESCRIPTION: Firebase is connected and so firebase:firebase-core:XX.X.X works, but then you wanto add a realtime database or the authentication package and the you find the next error:

Failed to resolve: firebase-database-15.0.0

I don't know why Firebase adds old versions to your project instead of the latest stable version, but here's the solution.

Just change your

implementation 'com.google.firebase:firebase-core:16.0.3'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1:15.0.0'

to the last version of each Firebase package (here) which, at the moment of writing this post, were the following:

implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-auth:16.0.4'
implementation 'com.google.firebase:firebase-database:16.0.3'

And everything will be working fine.

NOTE: Also, follow the instructions of the Firebase website to add a project manually (instead of using Firebase menu in Android Studio), which are shown when you add a project from the Firebase website, and that only implies a little bit more of work:

Add this to your gradle at "Project" level, inside the dependencies section
classpath 'com.google.gms:google-services:4.0.1'

And this to the end of the file of your gradle at "App" level
apply plugin: 'com.google.gms.google-services'

Comentarios