Add Firebase to Your Android Project

suggest change

Here are simplified steps (based on the official documentation) required to create a Firebase project and connect it with an Android app.

Add Firebase to your app

  1. Create a Firebase project in the Firebase console and click Create New Project.
  2. Click Add Firebase to your Android app and follow the setup steps.
  3. When prompted, enter your app’s package name.

It’s important to enter the fully qualified package name your app is using; this can only be set when you add an app to your Firebase project.

  1. At the end, you’ll download a google-services.json file. You can download this file again at any time.
  2. If you haven’t done so already, copy the google-services.json file into your project’s module folder, typically app/.

The next step is to Add the SDK to integrate the Firebase libraries in the project.

Add the SDK

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.

  1. Add rules to your root-level build.gradle file, to include the google-services plugin:
buildscript {
    // ...
    dependencies {
        // ...
        classpath 'com.google.gms:google-services:3.1.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:11.0.4'
}

// 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:11.0.4 | Analytics| |com.google.firebase:firebase-database:11.0.4 | Realtime Database| |com.google.firebase:firebase-storage:11.0.4 | Storage| |com.google.firebase:firebase-crash:11.0.4 | Crash Reporting| |com.google.firebase:firebase-auth:11.0.4 | Authentication| |com.google.firebase:firebase-messaging:11.0.4 | Cloud Messaging / Notifications| |com.google.firebase:firebase-config:11.0.4 | Remote Config| |com.google.firebase:firebase-invites:11.0.4 | Invites / Dynamic Links| |com.google.firebase:firebase-ads:11.0.4 | AdMob| |com.google.android.gms:play-services-appindexing:11.0.4 | App Indexing|

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents