File google-services.json is missing

  1. SDK Version: 44
  2. Platforms: Android

Hello :wave:

I would like to implement notifications in my Expo project. Acccording to the documentation, I have to use Firebase to send notifications on Android. But I have an issue about google-services.json file. I had checked thousands times each step of the tutorial but I always got the same error:

[stderr] Execution failed for task ':app:processReleaseGoogleServices'.
[stderr] > File google-services.json is missing. The Google Services Plugin cannot function without it. 
[stderr]    Searched Location: 
[stderr]   /home/expo/workingdir/build/android/app/src/release/google-services.json
[stderr]   /home/expo/workingdir/build/android/app/src/google-services.json
[stderr]   /home/expo/workingdir/build/android/app/src/Release/google-services.json
[stderr]   /home/expo/workingdir/build/android/app/google-services.json

The google-services.json file is present at the root of the projet, into android directory and android/app directory:

In the very top the my app/build.gradle file:

apply plugin: "com.android.application"
apply plugin: "com.google.gms.google-services"

In the android/build.gradle file:

buildscript {
    ext {
        buildToolsVersion = "29.0.3"
        minSdkVersion = 21
        compileSdkVersion = 31
        targetSdkVersion = 31
    }
    repositories {
        google()
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:4.1.0")

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files

        classpath 'com.google.gms:google-services:4.3.13'
    }
}

In the app.config.js file:

  android: {
    package: 'com.socialkitchen.app',
    googleServicesFile: './google-services.json',
  },

The package name is the same in google-services.json:

"android_client_info": {
    "package_name": "com.socialkitchen.app"
}

Any solution to fix it ?

Hey @simon_tannai,

The from the file organization of your project shared, it seems the ./google-services.json is not matching the the path you are describing in app.config.js file. Please update the path for googleServicesFile property.

Thank you @amanhimself for your answer

According to the project tree structure screenshot I put in my question, you can see a google-services.json at the same level than app.config.js.
So the path ./google-services.json for the property googleServicesFile shoud le good

My bad, I missed that part.

May I ask how are you creating your project? Seems like its bare workflow.

You don’t have it in .gitignore, do you?

@amanhimself we created the project from expo eject command. Then we updated some files to add our own custom code / plugins

@wodin google-services.json was added into .gitignore to not be commited

If you are adding google-services.json to .gitignore, this will cause the error you are facing. Try removing its mention from the .gitignore file.

Oh ! I removed it from .gitignore, it’s now working fine :grin:

How explain it ? Because I would like to avoid to commit this kind of file for security purpose

1 Like

I understand the feeling, but the documentation says:

Note: The google-services.json file contains unique and non-secret identifiers of your Firebase project. For more information, see Understand Firebase Projects.

If you really want to keep it out of your Git repository, you can work around it like this (it’s a bit ugly, though):

  • Copy .gitignore to .easignore.
  • Add google-services.json to .gitignore, but leave it out of .easignore

Then eas build will still upload it to the build servers during the build.

1 Like

Many thanks @wodin for these informations :grinning:

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.