Devesh Rx Logo
Devesh Rx Blog

Firebase Android Integration Without google-services.json file

July 2, 2025

Firebase Android Integration Without google-services.json file

Hi! In this blog/video, we are going to learn how you can add Firebase services to your Android application without using the google-services.json file.

Introduction

Whenever we add Firebase services to our Android application, we also add the google-services.json file into the app folder. This google-services.json file contains all the important API keys. So whenever you add any Firebase services to your Android application, you require that file.

However, when you work on big Android projects, sometimes you can’t use the google-services.json file because you have to synchronize the project on a Git repository or any version control system. In such scenarios, you have to use an alternate method, and that’s what we are going to learn today.

I am going to show you how you can integrate Firebase into your Android application even without the google-services.json file.

Understanding the google-services.json File

Let’s understand first what the importance of the google-services.json file is. Here I have created an Android app project with Firebase already integrated into it with the google-services.json file on the left side, as you can see.

When you open the google-services.json file, it contains all the necessary information about your Firebase project, such as:

  • Project ID
  • Firebase URL
  • Storage bucket
  • Package name
  • Important API keys

How the Google Services Plugin Works

The mechanism of this is very simple. When you add the Google Services plugin to your Gradle file, this plugin converts the google-services.json file into proper XML strings. You can check those XML strings by going into the app folder, and then there is a resource folder with “generated” in brackets.

Inside this folder, there is a values.xml file. You can open this values.xml file. This file is very important because it contains all the Firebase API keys derived from the google-services.json file.

Alternative Method: Manual Integration

Now, if you want to avoid using the google-services.json file, here is a simple method which I am going to show you:

Step 1: Copy the Generated Values

Simply copy the entire strings from the generated values.xml and then paste them into the strings.xml file.

Step 2: Modify Your Gradle File

Once you are done with this, open the Gradle file in your app module and then remove the Google Services plugin. I will comment it out.

Below, make sure you add all the Firebase dependencies like Analytics and the main BOM, and then synchronize your project.

Step 3: Remove the google-services.json File

Now the project is synchronized. As you can see, there is no error about the google-services.json file. After synchronization, we are removing the google-services.json file from our app folder.

After deleting this file, we can build our project. As you can see, the project is properly built without any errors because we already have stored all the Firebase variables in the strings.xml file.

Testing the Integration

Now, if you want to learn more about these variables, you can check the official Firebase website for all these variable constant names and strings.

Let’s check whether our Firebase integration is properly working or not. I have initialized Firebase Analytics and let’s debug this app.

As you can see, the app is running properly on the device without any errors. This means that our Firebase services are properly working on the device without any issues.

Alternative for CI/CD Pipelines

Now here is an alternative scenario. Imagine if you want to use a CI/CD pipeline and you have to synchronize this project into a Git repository. Obviously, you cannot synchronize with your API keys.

So there is another alternative: you can use environment variables instead of storing all the API keys in the values or strings.xml file.

Using Environment Variables

Create environment variables in the Gradle file. If you want to know how to create environment variables in Android Gradle, there is a video which I have previously made that you can refer to.

Then make these API keys into environment variables using your Gradle file. In this way, you can store all the important API keys as environment variables in your CI/CD pipeline setup.

Using those environment variables, you can dynamically create the XML file during the build process of your Android app.

Conclusion

The fundamental concept remains the same: you have to create the strings with the API keys, either using the Google Services plugin or without the Google Services plugin manually.

~ ~ THANK YOU FOR READING ~ ~

Share: