Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

expo push notifications "google-services.json" is missing for firebase

I am trying to setup push notifications for my expo react native app. Running in expo go everything works fine. Now for production I followed this Expo GUIDE.

The first 4 steps of this guide are reasonable.

But step 5 is very confusing:

  1. first of all, suddenly there is an app in the console, but there was no instruction to create one. So I just added one, with the same package name as in my app.json.
  2. Then it explains where to place the google-service.json file, how to reference it in the app.json and to put it into .gitignore. Which I have done.

a) But this results in a warning: File specified via "android.googleServicesFile" field in your app.json is not checked in to your repository and won't be uploaded to the builder.

b) and finally in a failed build: "google-services.json" is missing, make sure that the file exists. Remember that EAS Build only uploads the files tracked by git. Use EAS secrets to provide EAS Build with the file.

So do I have to put the content of the google-services.json file into an EAS secret? even though the guide mentions nothing about doing this and even says You're all set! You can now send notifications to Android devices via Expo Push Notifications using the FCM V1 protocol. ?

like image 718
aminator Avatar asked Sep 06 '25 00:09

aminator


1 Answers

I encountered in the same issue and I solved in 3 steps:

Step 1: Rename app.json file to app.config.js Note: use module exports to set the config the right way in .js file example:

module.exports = {
   expo: {
     //...rest of the configurations
    android: {
      //...rest of the configurations
      googleServicesFile: process.env.GOOGLE_SERVICES_JSON,
     },
   }
 }

Step 2: Add the file google-services.json into the project root folder.

Step 3: Run this command in the project root directory

eas env:create --scope project --name GOOGLE_SERVICES_JSON --type file --value ./google-services.json

Make sure if ./google-services.json is the actual path to your google-services.json file.

like image 138
Anas Avatar answered Sep 07 '25 21:09

Anas