Error "File google-services.json is missing from module root folder. The Google Services Plugin cannot function without it"

AndroidGoogle Play-ServicesAndroid Gradle-Plugin

Android Problem Overview


I updated my project to the latest Play services classpath 'com.google.gms:google-services:1.5.0-beta2'. I am also using the latest version of playservices in my app.gradle file as:

compile 'com.google.android.gms:play-services-location:8.3.0'
compile 'com.google.android.gms:play-services-gcm:8.3.0'

However when I compile, Gradle throws exception as follows

Error:Execution failed for task ':app:processDebugGoogleServices'. > File google-services.json is missing from module root folder. The Google Services Plugin cannot function without it.

Android Solutions


Solution 1 - Android

You need to get the configuration file from the developer's site and paste it in the app level directory of your project.

Update:

Goto

  1. https://console.firebase.google.com/

  2. Select your project

  3. On the left menu, click on settings > project settings

  4. Add an app or download the google-services.json file under the Your Apps section.

Solution 2 - Android

Please go to this URL :

<https://developers.google.com/mobile/add>

Choose your Options and finally you will be able to download

google-service.json file

copy that file and paste it Into

YourProjectName/app Directory

Then recompile the project Most probably it will fly

In my case the project directory looks like this :

enter image description here

Solution 3 - Android

For anyone using Firebase you need to go into your console and there it should say "add project to Android". From there, it will step-by-step generate the google-services.json file for you.

Solution 4 - Android

I received this error while trying to run Google's Firebase analytics sample app:

Prerequisites:

Add Procedure:

  1. Go to https://firebase.google.com/
  2. Click on "GO TO CONSOLE"
  3. Click on "Add Project"
  4. Project name: Enter: sample-app
  5. Click "Create Project" [Takes about 10 seconds or so...]
  6. Click "Continue"
  7. On the "Getting Started" page, click "Add Firebase to your Android app"
  8. Enter package name for the android app [The full package name appears at the top of the manifest: "com.google.firebase.quickstart.analytics"]
  9. Click on download google-services.json
  10. In file explorer, add google-services.json to the directory: "quickstart/analytics/app" [Warning: Do not rename the file, it must be: google-services.json]
  11. Run 'app' * The sample app already contains the necessary Gradle file settings. * When adding a new project do: Tools -> Firebase -> Analytics -> Add Event -> Connect App to Firebase. * Adding a project via Android Studio ensures that all the Gradle Dependecies are setup.

Remove Procedure:

  1. Go to https://firebase.google.com/
  2. Click on "GO TO CONSOLE"
  3. Settings -> Project Settings -> Delete this App
  4. Settings -> Project Settings -> Delete Project
  5. Enter project ID and press delete

I added and removed the sample app multiple times without any noticeable side effects.

Solution 5 - Android

in my case i have saved a json file with a space like this

> google-services .json

and the right one is

> google-services.json

and also take care you do not put (_) instead of (-)

may help some one.

Solution 6 - Android

If you don't need it anymore…

…\build.gradle:

classpath 'com.google.gms:google-services:3.2.0'

->

// classpath 'com.google.gms:google-services:3.2.0'

…\app\build.gradle:

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

->

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

Solution 7 - Android

You must go on Firebase console-->Settings-->Project Settings and there will be section with Download the latest config file. Download google-service.json and put into app folder. It's work for me. Links: https://developers.google.com/identity/sign-in/android/start-integrating https://developers.google.com/android/guides/client-auth

Solution 8 - Android

I just run into problem downloading google-services.json from Firebase console. Turns out I had to log out from all other google accounts than the one I was using for Firebase.

Solution 9 - Android

For Cordova Apps:

We need to place the google-services.json file in app root (I believe; when working with Cordova apps, we are not to get into other folders/files such as Gradle, Java files, platforms, etc; instead only work with them VIA the config.xml and www folder) and refer it in the config.xml like so:

<platform name="android">
    <!-- Add this line -->
    <resource-file src="google-services.json" target="app/google-services.json" />
</platform>
NOTE: Ensure that the Firebase App packagename is same as the id attribute in <widget id="<packagename>" ... > are same.

For ex:

<!-- config.xml of Cordova App -->
<widget id="com.appFactory.torchapp" ...>

<!--google-serivces.json from generated from Firebase console.-->
{
  ...
  packagename: "com.appFactory.torchapp",
  ...
}

Good Luck...

Solution 10 - Android

https://developers.google.com/android/ you need to generate configuration file which gives you access to all the services and APIs you registered for in developer console and place it in your root directory

Solution 11 - Android

In android studio:

  1. switch to Project view so you can see the actual project folder structure.
  2. find google-services.json file and drag it to the app directory (for some reason when I added it using file explorer, it put it in the gradle folder).
  3. Clean/Rebuild project.

It worked fine for me from there.

Solution 12 - Android

Go to the configuration file from the developer's site and paste it in the app level directory of your current project.

Solution 13 - Android

Very Simple Just go to Tools->Firebase->Connect to firebase than click on sync now THIS WILL SURELY WORK.

Solution 14 - Android

Go to Tools-->Firebase in your Android Studio and click on Connect your app to Firebase. They will set it up for you.

Solution 15 - Android

> Easiest way to add google-service.json file

In Android Studio follow these steps:

Click Tools > Firebase to open the Assistant window.

Click to expand one of the listed features (for example, Analytics), then click the Get Started tutorial to connect to Firebase and add the necessary code to your app.

Solution 16 - Android

I had the same problem. The problem is because of renaming the file. You might have downloaded number of google-services.json file in you downloads folder. So when you download a new file it will download with same name but by adding numeric values in brackets. something like google-services(1).json .So you will delete this (1) and copy the file. Make sure when you are renaming it there should not be any spaces or extra . in the name of the file.

Solution 17 - Android

Even after adding all the dependencies and the file if you face any such problem it could be your incorrect file name of "google-services.json".

Make sure you have the exact file name without any additional spaces or characters.

I had renamed the file and had space" " in my filename which was not noticeable, later I found that my file name is wrong, so fixed it!.

Solution 18 - Android

If you don't have access to the Firebase of the project, for example, you downloaded an example source code then you have to remove any Firebase related stuff to make the project run.

Search keywords in the project

  • List item
  • fabric
  • firebase
  • google-services
  • crashlytics

Solution 19 - Android

That Problem is because:- The folder or file you pasted to your product downloaded from the firebase console is not named as google-services.json. so now click it then right mouse click in all the options open refractor and rename it to google-services.json. because this worked for me

Solution 20 - Android

Had faced same issue ..

well in my case i have saved

> google-services.json

as

> google_services.json

I tried every solution mentioned above but nothing helps... the error was instead of "_" you need to put "-"(dash).

Just refactoring the file to google-services.json from google_services.json works like charm..

Hope this helps!!!

P.S. I know it's sound silly but this only works for me...

Solution 21 - Android

Steps:

  1. Navigate to your project folder and open the /app sub-folder.

  2. Paste the .json file here.

  3. Rebuild the project.

Solution 22 - Android

for people coming here from the firebase codelabs tutorial step 3:go to page 4.

Apparently, if google says You should now have the android-start project open in Android Studio. ,She means it,and not You should now have the android-start project open in Android Studio, without any build-errors .
As the instruction says there, you have to get a configuration file from firebase. i.e , create a new project in your firebase acc with name 'friendly chat and in the next page , add its package name and SHA1 KEY.
after downloading the json file,add it to your project>app folder, and Rebuild project.

Solution 23 - Android

https://developers.google.com/mobile/add

select get started and go to settings logo and then project settings after that you will see below the platform like web,android,ios . select that according to your preference. and then download google-service.json file

copy that file and paste it Into

YourProjec/app Directory and then finally sync again .

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionwilliamj949View Question on Stackoverflow
Solution 1 - Androidjohnrao07View Answer on Stackoverflow
Solution 2 - AndroiderluxmanView Answer on Stackoverflow
Solution 3 - AndroidMicroView Answer on Stackoverflow
Solution 4 - AndroidElletlarView Answer on Stackoverflow
Solution 5 - AndroidAbdalrhman AlkhulaqiView Answer on Stackoverflow
Solution 6 - Androiduser_MGUView Answer on Stackoverflow
Solution 7 - AndroidOqiView Answer on Stackoverflow
Solution 8 - AndroidkarView Answer on Stackoverflow
Solution 9 - AndroidAakashView Answer on Stackoverflow
Solution 10 - AndroidRameshView Answer on Stackoverflow
Solution 11 - Androidironmantis7xView Answer on Stackoverflow
Solution 12 - AndroidAvanish SinghView Answer on Stackoverflow
Solution 13 - AndroidykbView Answer on Stackoverflow
Solution 14 - AndroidIshamView Answer on Stackoverflow
Solution 15 - AndroidAmir Dora.View Answer on Stackoverflow
Solution 16 - AndroidTaraView Answer on Stackoverflow
Solution 17 - AndroidGirish B.RView Answer on Stackoverflow
Solution 18 - AndroidMoaz RashadView Answer on Stackoverflow
Solution 19 - Androidabdulrehman javedView Answer on Stackoverflow
Solution 20 - AndroidPN10View Answer on Stackoverflow
Solution 21 - AndroidSaurabh SinghView Answer on Stackoverflow
Solution 22 - Androidansh sachdevaView Answer on Stackoverflow
Solution 23 - Androidarpit1714View Answer on Stackoverflow