How to Add Firebase to your Android Project


From the previous article I gave you a brief introduction on Firebase. This article will help you to know how to add Fire base to your Android project.Lets get started .

Go to your firebase dashboard for the android project that we created in the last article.You would get a similar interface as below. But this may be changes with time.


On the dashboard there is an option to select Add firebase to your Android app.Select it and you will get similar window as given below.
Here you will be asked the Android package name which is the package name of your added Android project. Add it there.

com.example.user.myandroidapp is my package name and you can get it from MainActivity.java file.
Next you will be asked to fill the Debug signing certificate SHA-1 . This is optional but it is good to add it. 
To add this go to your android studio and click the button Gradle in the top right.You will get a similar window given below.Click signingReport


So now you will get a new panel. Inside it you can find Debug signing certificate SHA-1 value.Copy it and pastein the  given space.It will secure your app.Then click Register App.
Now you have to download the google.json file
Now drag and drop the partcular file to the app folder in your android project.


Now click continue to start the last part.



Now you will get a similar code given below
buildscript {
  dependencies {
    // Add this line
    classpath 'com.google.gms:google-services:3.2.0'
  }
}

Copy the highlighted line and select the folder shown in the below image.


Now paste it below the classpath 'com.android.tools.build:gradle:2.3.3'.Make sure that you copy the path to the Project-level build.gradle file.Now for the app-level file  copy the path given in the above 2 part

dependencies {
  // Add this line
  compile 'com.google.firebase:firebase-core:11.8.0'
}
...
// Add to the bottom of the file
apply plugin: 'com.google.gms.google-services'

Now hit the finish button.Now you can see the project has been added to the firebase backend.Now  you can easily do the backend development of your Android Project using Firebase.






Comments

Popular posts from this blog

Java Part 2 :How to Install Java

Working with Buttons in Android Studio

Ruby - Dynamic, Open source programming language