Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

failed to resolve: com.google.firebase:firebase-database:10.2.0

I am creating a new project and trying to implement some features from googles Fire base dependencies such as compile 'com.google.firebase:firebase-database:10.2.0, classpath 'com.google.gms:google-services:3.0.0' ' and sync my project with them. When trying to do so, I get this error:

Error:(25, 13) Failed to resolve: com.google.firebase:firebase-database:10.2.0
<a href="openFile:M:/Downloads/CommunicationApp/app/build.gradle">Show in File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>

and also this error:

Error:Failed to resolve: com.google.firebase:firebase-core:10.2.0
<a href="openFile:M:/Downloads/CommunicationApp/app/build.gradle">Open File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>

If anyone knows a solution for me, many thanks!

like image 765
Eamon Sharp Avatar asked Feb 26 '17 22:02

Eamon Sharp


1 Answers

I faced the same issue when I tried to use firebase-messaging:10.2.0 and to fix that I did this:

  • On Android studio, go to the menu bar and click on Tools > Android > SDK Manager.
  • Click on the SDK Tools tab
  • check the Google Play services box as well as the Google Repository box.
  • Click on apply, it will prompt you before applying the new updates.
  • Click Ok and wait for the download
  • Sync your project again and everything is fine.

Note: All com.google.android.gms libraries must use the exact same version specification (mixing versions can lead to runtime crashes). If you already have an existing dependency of google play services upgrade it to the same version as firebase.

compile 'com.google.android.gms:play-services:10.2.0'
compile 'com.google.firebase:firebase-database:10.2.0'

Hope that helps!

like image 182
Maximilien Belinga Avatar answered Oct 23 '22 16:10

Maximilien Belinga