Integrate Firebase into Android Project

This article will help you to integrate Firebase into your Android Project.

Prerequisite:

First, you need to create a project into Firebase Console, for that you can follow our guide Firebase integration for beginners.

Steps to Integrate Firebase into Your Android Project

1. Go to Firebase Console and click on your Project you just created in the previous step.

2. On the project page, you will see an option to add a platform into your Project, Click on Android Platform, as shown in the following screenshot.

Add Android Platform to Firebase
Add Android Platform to Firebase

Register App on Firebase

3. On the next page, add your App details, package name, Your App Nickname (App will be visible in Firebase Console with this name) And optional Signing Certificate SHA-1. I am not writing the steps here to generate a signing certificate, but you can have a look at our other article to see How to Generate Signing Certificate SHA-1. After filling the details press Register App button.

Add your App Details
Add your App Details

4. Firebase will automatically create a file named google-services.json, you need to download it and add it to your project. For that open your Android Studio, From the left Project Pane, Click on the top dropdown and Choose Project and paste google-services.json file under your App directory, as shown in the following screenshots.

Paste Google Services JSON File
Paste Google Services JSON File

5. Now you need to add Firebase SDK into your Android project, you can only add that SDK which service you need to use, like Firebase Authentication, Firebase Database, Storage and others. The list of latest versions of Firebase SDKs is here. Here I will only add Firebase Core, which provides Firebase Analytics.

In your Project level build.gradle add following classpath in dependencies block.

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

Also, make sure that Google’s Maven repository is present under repositories & allprojects block. like

repositories {
        google()
        jcenter()
}
Project Level build.gradle File
Project Level build.gradle File

6. Now open App level build.gradle file and add the dependency of your required Firebase SDK, as I will add the following Firebase Core SDK.

implementation 'com.google.firebase:firebase-core:17.2.0'

Also, apply Google plugin by adding the following line at the end of the App level build.gradle file

apply plugin: 'com.google.gms.google-services'

Screenshot of full App level build.gradle file

App Level build.gradle File
App Level build.gradle File

7. Finally, sync your project by pressing Sync Now button on the top right corner and you are done adding Firebase into your Android Project.

If you are working on Firebase Storage also have a look at

Please share this post:
Native Mobile Application Developer (Android + IOS) having experience in Java, Swift, Kotlin, Objective C, Unity, C#, C/C++, NODE JS & PHP.

2 thoughts on “Integrate Firebase into Android Project

  1. Hello.This post was really fascinating, especially since I was looking for thoughts on this matter last Friday.

Ask a Question

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.

%d bloggers like this: