Here the steps required to create a Firebase project and to connect with an Android app.
Create a Firebase project in the Firebase console and click Create New Project.
Click Add Firebase to your Android app and follow the setup steps.
When prompted, enter your app's package name.
It's important to enter the package name your app is using; this can only be set when you add an app to your Firebase project.
To add debug signing certificate SHA1 which is required for Dynamic Links, Invites, and Google Sign-In support in Auth, go to your project in Android Studio, click on Gradle
tab on the right side of your window, click on Refresh
button, go to project(root)
-> Tasks
-> android
-> signingReport
. This will generate MD5 and SHA1 both in Run
tab. Copy paste SHA1 into firebase console.
At the end, you'll download a google-services.json
file. You can download this file again at any time.
If you haven't done so already, copy this into your project's module folder, typically app/.
The next step is to Add the SDK to integrate the Firebase libraries in the project.
To integrate the Firebase libraries into one of your own projects, you need to perform a few basic tasks to prepare your Android Studio project. You may have already done this as part of adding Firebase to your app.
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'
The final step is to add the dependencies for the Firebase SDK using one or more libraries available for the different Firebase features.
Gradle Dependency Line | Service |
---|---|
com.google.firebase:firebase-core:9.4.0 | Analytics |
com.google.firebase:firebase-database:9.4.0 | Realtime Database |
com.google.firebase:firebase-storage:9.4.0 | Storage |
com.google.firebase:firebase-crash:9.4.0 | Crash Reporting |
com.google.firebase:firebase-auth:9.4.0 | Authentication |
com.google.firebase:firebase-messaging:9.4.0 | Cloud Messaging / Notifications |
com.google.firebase:firebase-config:9.4.0 | Remote Config |
com.google.firebase:firebase-invites:9.4.0 | Invites / Dynamic Links |
com.google.firebase:firebase-ads:9.4.0 | AdMob |
com.google.android.gms:play-services-appindexing:9.4.0 | App Indexing |