GoogleService failed to initialize

Zach picture Zach · Dec 19, 2015 · Viewed 99k times · Source

I am using google Maps in my android application. I have created the key and added necessary permissions in manifest file. But soon I start the application I get this message in debugger:

GoogleService failed to initialize, status: 10, Missing an expected resource: 'R.string.google_app_id' for initializing Google services. Possible causes are missing google-services.json or com.google.gms.google-services gradle plugin.

I am not sure whats wrong. The Map is working fine and I can use it without any issues. My gradle file has this entry:

compile 'com.google.android.gms:play-services:8.4.0'

What is it complaining about and how do I alleviate it?

Answer

Sriram picture Sriram · Jun 9, 2016

[From Product Manager @ Google]

You can fix this issue by downloading and copying the google-services.json file for your Android app by following the steps below:

  • Select your app/project name and Android packagename from this link and click Continue to Choose and configure services.
  • Click Continue to Generate Configuration files.
  • Download google-services.json and copy the file to the app/ or mobile/ module directory in your Android project.

If you have previously imported your Google project into Firebase, you can get the updated google-services.json from the Firebase console under Project Settings.

DO NOT COPY the PROJECT_NUMBER as suggested by one of the other answers since the google_app_id refers to your app within a Project and not the project itself.