Get a Firebase configuration file
1. The first thing you need to do to get started with Firebase is, sign up for a free account. You can use your Google account to sign in to your Firebase account.2. After clicking on ‘Sign In with Google’, you might be asked to allow the Firebase to view your Email and your basic profile. Click on Allow button to continue.
3. Once you are signed in, Click on Go to your Console button if you are not automatically redirected to your Firebase console. Click on Create New Project button in your Firebase console.
4. Now you can see an overview of your new Firebase project. Now click on Add Firebase to your Android App as shown below.
5. Now you need to enter your application details (your application’s package name) and also get SHA-1 finger print and paste it in the field as shown below. Check out the note below on how to get SHA-1 from Android Studio.
Click on Add App button. Upon clicking it, a file named google-services.json gets downloaded to your machine.
Note : Following image shows how to get SHA-1 from Android Studio.
6. Download the google-services.json file and paste in the app folder of your Android application.
Note: If you forget to place google-services.json file under app folder, you will get the following error when you build your app.
7. Open the build.gradle (Project level) file of your android application and add classpath ‘com.google.gms:google-services:3.0.0’ in the dependencies section. Your build.gradle (Project level) file will look as shown below.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}