Anubhav Singh
Anubhav Singh

Reputation: 8699

Adding Firebase to android Studio fails to resolve

I am trying to add Firebase references to my android app but facing the following problem:

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

screenshot here

Upvotes: 1

Views: 11464

Answers (4)

Xantre
Xantre

Reputation: 1

I just had the same problem with adding Firebase. I found that there seems to be a difference between adding the json file when following the steps given, vs adding the json file after the project is established in Firebase.

You might try clicking through to the Settings of your project and downloading that version of json. It fixed all the completely random errors that I was getting that made no sense.

Upvotes: 0

Vishal Kamboj
Vishal Kamboj

Reputation: 5

First make sure you have installed Google Repository version 26 or higher, using the following steps:

IF You missing FireBase ..

Click Tools > Android > SDK Manager. Click the SDK Tools tab. Check the Google Repository checkbox, and click OK. Click OK to install. Click Background to complete the installation in the background, or wait for the installation to complete and click Finish. You can now open and use the Assistant window in Android Studio by following these steps:

Click Tools > Firebase to open the Assistant window...

Upvotes: -1

Kalu Singh Rao
Kalu Singh Rao

Reputation: 1697

To connect your app to Firebase directly in Android Studio, proceed as follows:

Make sure you have downloaded the Google Repository version 26 or higher:

Click Tools > Android > SDK Manager.

Click the SDK Tools tab.

Select Google Repository, then click OK.

Open the Assistant window by clicking Tools > Firebase.

Click to expand one of the listed features such as Analytics then click the Get Started tutorial to create a new Firebase project or connect to an existing one in a few clicks.

First, add rules to your root-level build.gradle file, to include the google-services plugin:

buildscript {
    // ...
    dependencies {
        // ...
        classpath 'com.google.gms:google-services:3.0.0'
    }
}

Then, in your module Gradle file (usually the app/build.gradle), add the apply plugin line at the bottom of the file to enable the Gradle plugin:

apply plugin: 'com.android.application'

android {
  // ...
}

dependencies {
  // ...
  compile 'com.google.firebase:firebase-core:9.4.0'
}

// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'

You can also follow below link to add firebase in android app.

https://firebase.google.com/docs/android/setup

Upvotes: 4

Dentor
Dentor

Reputation: 600

Follow these steps

Upgrade your Google Play Services and Google Repository.

In Android Studio

  • Click Tools > Android > SDK Manager
  • Click into the SDK Tools tab
  • Select and install Google Play Services and Google Repository
  • Sync and Build your project.

Follow this link to check how to update Google Play Services and Repository. https://developer.android.com/studio/intro/update.html

Upvotes: 4

Related Questions