Firebase is a mobile and web application development platform developed by Google. We can build our apps very fast, without making complex back-end system. It helps to scale automatically, for even the largest apps. In this tutorial, we’re gonna go through the steps to integrate Firebase into Android App with Android Studio Enviroment.
– Android Studio 2.x
– Firebase Android SDK 11.x
II. Step by Step
1. Get SHA-1 Key
– Open your Android Project, in Gradle projects window, double-click on signingReport:
– Look at Run window, you can find SHA-1 Key:
2. Create Project on Firebase
Go to Firebase Console, login with your Google Account, then click on Add Project.
Enter Project name, select Country/Region:
Press CREATE PROJECT, a Popup will be shown.
3. Add Firebase to Android App
3.1 Register App
Fill Android package name, App nickname, and SHA-1 (got from step 1):
Click on REGISTER APP.
3.2 Download and add config file
– Click on Download google-services.json to download the config JSON file:
– Move google-services.json into your Android App root directory:
Click on CONTINUE. You will come to:
3.3 Add Firebase SDK
– Open build.gradle (project-level), add:
– Open build.gradle (App-level), add:
apply plugin: 'com.google.gms.google-services'
– Re-sync Gradle files:
Tool -> Android -> Sync Project with Gradle Files.
III. When sync fails
– Make sure that package_name in google-services.json has a correct value according to:
+ applicationId in build.gradle (App-level).
+ package in AndroidManifest.xml.
– Open SDK Manager to update:
+ Google Play services
+ Google Repository
Last updated on July 13, 2018.