Android Learning
HomeBlogAbout

Android Learning

Learn Android development with comprehensive tutorials, guides, and best practices. From beginner to advanced Android programming.

Quick Links

  • Home
  • Blog
  • About
  • Contact
  • Newsletter

Resources

  • Android Developers
  • Kotlin Docs
  • Jetpack Compose

© 2026 Android Learning. All rights reserved.

Privacy PolicyTerms of Service
Back to Blog
May 24, 2016
7 min read
Akshay Raj

Add Firebase to your Android Project

Add Firebase to your Android Project

Akshay Raj

Android development expert

Firebase gives you the tools to develop high-quality apps, grow your user base, and earn more money. We cover the essentials so you can monetize your business and focus on your users.

Prerequisites

  • A device running Android 2.3 (Gingerbread) or newer, and Google Play services 9.0.0 or newer
  • The Google Play services SDK from the Android SDK Manager
  • Android Studio 1.5 or higher
  • An Android Studio project and its package name
Instant Run in Android Studio prior to version 2.2 is incompatible with Firebase Analytics and prevents certain events from being collected. We recommend either disabling instant run
or upgrading to the Android Studio 2.2 preview.
If you don't have an Android Studio project already, you can download one of our quickstart samples if you just want to try a Firebase feature. If you're using a quickstart, remember to get the package name from the ApplicationManifest.xml, you'll need it for the next step.
Note: If you are upgrading from a 2.X version of the Firebase SDK, see our upgrade guide for Android
to get started.

Add Firebase to your app

It's time to add Firebase to your app. To do this you'll need a Firebase project and a Firebase configuration file for your app.
  1. Create a Firebase project in the Firebase console, if you don't already have one. If you already have an existing Google project associated with your mobile app, click Import Google Project. Otherwise, clickCreate New Project.
  2. Click Add Firebase to your Android app and follow the setup steps. If you're importing an existing Google project, this may happen automatically and you can just download the config file.
  3. 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.
  4. At the end, you'll download a google-services.json file. You can download this file again at any time.
  5. If you haven't done so already, copy this into your project's module folder, typically app/.
Note: If you have multiple build variants with different package names defined, each app must be added to your project in Firebase console.

Add the SDK

If you would like 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. First, add rules to your root-level 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) file, 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:10.2.1'
  // Getting a "Could not find" error? Make sure you have
  // the latest Google Repository in the Android SDK manager
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
You should also add the dependencies for the Firebase SDKs you wish to use - we recommend starting with thefirebase-core, which include Firebase Analytics, but see below for the full list.

Available libraries

These libraries are available for the different Firebase features.
Gradle Dependency Line Service
com.google.firebase:firebase-core:9.0.0 Analytics
com.google.firebase:firebase-database:9.0.0 Realtime Database
com.google.firebase:firebase-storage:9.0.0 Storage
com.google.firebase:firebase-crash:9.0.0 Crash Reporting
com.google.firebase:firebase-auth:9.0.0 Authentication
com.google.firebase:firebase-messaging:9.0.0 Cloud Messaging / Notifications
com.google.firebase:firebase-config:9.0.0 Remote Config
com.google.firebase:firebase-invites:9.0.0 Invites / Dynamic Links
com.google.firebase:firebase-ads:9.0.0 AdMob
com.google.android.gms:play-services-appindexing:9.0.0 App Indexing
 
from Google Docs you can use Google Docs for more information...

Tags

#fcm#firebase#google analytics

Comments

No comments yet.

Enjoyed this article?

Subscribe to our newsletter to get more articles like this delivered to your inbox.