How to integrate Firebase into Android App – Android Studio

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.

I. Technology

– 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:
firebase-signingreport

– Look at Run window, you can find SHA-1 Key:
firebase-sha-1

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:
firebase-create-project

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):
firebase-register-app

Click on REGISTER APP.

3.2 Download and add config file

– Click on Download google-services.json to download the config JSON file:
firebase-download-config-file

– Move google-services.json into your Android App root directory:
firebase-config-file

Click on CONTINUE. You will come to:
firebase-add-sdk

3.3 Add Firebase SDK

– Open build.gradle (project-level), add:

buildscript {
    // ...
    dependencies {
        // ...
        classpath 'com.google.gms:google-services:3.1.0'
    }
}

firebase-add-sdk-project-level

– Open build.gradle (App-level), add:

dependencies {
  // ...
  compile 'com.google.firebase:firebase-core:11.0.2'
}

apply plugin: 'com.google.gms.google-services'

firebase-add-sdk-app-level

– 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

33 thoughts on “How to integrate Firebase into Android App – Android Studio”

  1. Hey! This is my first visit to your blog! We are a team of volunteers and starting a
    new project in a community in the same niche.

    Your blog provided us valuable information to work
    on. You have done a outstanding job!

  2. Have you ever thought about including a little bit more than just your articles?
    I mean, what you say is fundamental and all. However just imagine
    if you added some great visuals or video clips to give your posts
    more, “pop”! Your content is excellent but with pics and clips,
    this blog could certainly be one of the best in its field.

    Amazing blog!

  3. Great blog you have here but I was wanting to know
    if you knew of any community forums that cover the same
    topics talked about here? I’d really like to be a part
    of group where I can get responses from other
    knowledgeable people that share the same interest.

    If you have any recommendations, please let me know.
    Thanks!

  4. Hi are using WordPress for your site platform? I’m new to
    the blog world but I’m trying to get started and set up my own. Do
    you require any coding knowledge to make your own blog?
    Any help would be greatly appreciated!

  5. Hello, I think your web site might be having web browser compatibility problems.

    When I take a look at your web site in Safari, it looks fine however when opening in Internet Explorer,
    it’s got some overlapping issues. I simply wanted to give you a quick heads up!
    Other than that, fantastic site!

  6. Hi! I just wanted to ask if you ever have any trouble with hackers?
    My last blog (wordpress) was hacked and I ended up losing months of hard work due to
    no back up. Do you have any methods to protect against hackers?

  7. This is very interesting, You’re a very skilled blogger. I’ve joined your feed
    and look forward to seeking more of your wonderful post.
    Also, I’ve shared your web site in my social networks!

  8. Wе stumbbled ᧐ver here different webseitе and thought I maʏ as well check things
    out. Ilike what I see so now i’m following you. Looк forward to ⅼooking into your web page yet again.

  9. Nice poѕt. I learn sоmething totally new and сhallenging on sites I stumbleupon on a daily basіs.
    It wioll always be еⲭciting to rread articles from other
    authors and practice a little something from otheг
    websites.

  10. Thanks for ones marvelous posting! I really enjoyed reading it,
    you might be a great author.I will make certain to bookmark your blog and
    may come back someday. I want to encourage you to ultimately continue your great posts, have a nice day!

  11. My partner and I stumbled over here coming from a different website and thought
    I may as well check things out. I like what I see so now i’m
    following you. Look forward to finding out about your web page repeatedly.

  12. I loved as much as you’ll receive carried out right here.
    The sketch is attractive, your authored subject matter stylish.

    nonetheless, you command get bought an impatience over
    that you wish be delivering the following. unwell unquestionably come
    more formerly again since exactly the same nearly a lot often inside case you shield this increase.

  13. Greetings! This is my first visit to your blog! We are a group of volunteers and
    starting a new project in a community in the same niche. Your blog provided
    us valuable information to work on. You have done a marvellous job!

  14. I was suggested this blog by my cousin. I’m not sure whether this post is written by
    him as no one else know such detailed about my difficulty.

    You’re wonderful! Thanks!

  15. Heya i’m for the first time here. I found this board and
    I find It really useful & it helped me out a
    lot. I hope to give something back and aid others like you aided me.

  16. I’m truly enjoying the design and layout of your website.
    It’s a very easy on the eyes which makes it much more pleasant for me to come here and visit more
    often. Did you hire out a designer to create your theme? Superb work!

Leave a Reply

Your email address will not be published. Required fields are marked *