Home » Android » android – Missing api_key/current key with Google Services 3.0.0

android – Missing api_key/current key with Google Services 3.0.0

Posted by: admin March 10, 2020 Leave a comment


Since I upgraded the project with the latest version of google services and libraries (9.0.0), I have this strange issue :

Error build

Grade console :

Parsing json file: /Users/cyrilmorales/Documents/Projects/mobilemeans-punainenristi/app/google-services.json
:app:processDebugGoogleServices FAILED
Error:Execution failed for task ':app:processDebugGoogleServices'.
> Missing api_key/current_key object
Information:BUILD FAILED

build.gradle (root) :

dependencies {
    classpath 'com.android.tools.build:gradle:2.2.0-alpha1'
    classpath 'com.google.gms:google-services:3.0.0'

build.gradle (app) :

dependencies {
    compile 'com.google.android.gms:play-services-analytics:9.0.0'
    compile 'com.google.android.gms:play-services-gcm:9.0.0'
    compile 'com.google.android.gms:play-services-maps:9.0.0'
    compile 'com.google.android.gms:play-services-location:9.0.0'
apply plugin: 'com.google.gms.google-services'

However, it works well with the play service libraries in 8.4.0 and google-services 2.1.0

Do you have any idea of the solution ?

How to&Answers:

Generate new config file (google-services.json) from: https://developers.google.com/cloud-messaging/android/client#get-config

Newly config file with "api_key": [ { "current_key": XXX } ] in client section

Update: or manually enabled service in developer console and generate key.


Adding empty current key value in google-services.json file solved this problem for me

"api_key": [{ "current_key": "" }]


Yes, as for the first time using with Firebase, i face like that.Click on your app menu and click “Manage”.

enter image description here

you can download google-services.json again.

enter image description here


For everyone that have this issue, for now, you’ll need to add any service to your app at https://developers.google.com/cloud-messaging/android/client#get-config

In my case I have added admob (already have analytics and gcm) and then the file was generated with api_key.

I think’s it’s a bug and will be soon fixed, until that, do it.


Although Jozka Jozin’s accepted answer and its comments, Cloud Messaging is neither related nor required.

Nevertheless, re-generating google-services.json is the key to solution (so I voted him). Below is what I did:

As you know you can generate the config file for Analytics from the Google Developers Guide.

1: Choose your app.

1) choose an app

2: Close the popup! It hides…

Close the popup!


the hidden option of admob

4: Of course, select and enable it!

enable it!

5: Now we can rightly generate configuration files!

generate configuration files

6: We made it! This time, the configuration file should include the api_key appropriately.

we made it!

Conclusion: The UI of the interactive generation tool is a bit confusing…


You can download the google-services.json file again.

Steps to download:

1). Click on the top menu in your app in the Firebase Console.

2). Click on manage.

3). You will find Download the latest config file option, download and replace the google-services.json file in your application.


First in your JSON file


"api_key": []


"api_key": [{ "current_key": "" }]

Then the gradle build will be successful but when you run your application you may get errors like the following..

Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/LICENSE
    File1: C:\Users\bucky\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-core.2.2\d20be6a5ddd6f8cfd36ebf6dea329873a1c41f1b\jackson-core-2.2.2.jar
    File2: C:\Users\bucky\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-databind.2.2c8f6018eaa72d43b261181e801e6f8676c16ef6\jackson-databind-2.2.2.jar
    File3: C:\Users\bucky\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-annotations.2.25cb9c666f0f0f3dd8a1be04e1f457eb7b15113\jackson-annotations-2.2.2.jar

To fix this issue you can add the following to your app.gradle file.. It worked for me.

packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/ASL2.0'

It showed me some error later while building the apk file. So I had to download the json file again. After 2 trial I got the json file with a valid api key.


If you are not using Firebase, the correct link to generate the google-services.json config file is actually found here.


regenerate google-services.json at https://developers.google.com/cloud-messaging/android/client#get-config,one important thing is that you must enable Cloud Messaging in “Choose services” step ,open the new google-services.json file you will see words like

    "api_key": [
       "current_key": "xxxxxxxxxxx"

without this words or without value of current_key is not the right file


I was able to solve this problem with these steps that are not answered here. This answer is NOT enabling Cloud Messaging, it is only retrieving its server key.

So first, go to Firebase Console, and then go to Project Settings, and then click on the tab “Cloud Messaging”. Look where it says “server key” and if there is no long key displaying (not the “Sender ID” number) click “Regenerate Key” and a long key should now show. Copy that key and place it in your google-services.json file at: "api_key": [ {"current_key" : "key goes here"} ].

This method helped me while none of the others were working, so hopefully this helps someone.


enter image description here

Click on Overview -> Gear icon -> Project settings.

enter image description here

Go to Download latest config and Click on google-service.json button to download file and save it to app folder and Compile again. Enjoy!


You need to add SHA certificate fingerprints to your project and then download the google-services.jason file again, which should contain “api_key”: [{ “current_key”: “xxxxxx” }] automatically.

You can view following page to see how to generate the fingerprints:


On windows, just execute following command, and use android as password for debug purpose:

keytool -exportcert -list -v -alias androiddebugkey -keystore %USERPROFILE%\.android\debug.keystore


Using Firebase

GoogleServices'. > Missing api_key/current_key object

I got this error after updating an existing project to the new Firebase Services.
The generated google-service.json file downloaded from the firebase project settings page did not include the api_key needed.

From the other answers here it looks like Google/Firebase Cloud
(GCM/FCM) needs to be added for this api_key to be included
in the google-service.json file.

So I added a dependencies on the firebase FCM before downloading the file again, and this time the key was included.

Include FCM (GCM)

dependencies {
     compile 'com.google.firebase:firebase-messaging:9.0.0'


If you don’t want to reconfigure and download the google-services.json file then you can fetch the api key directly from firebase console. Just go to

Overview > Add another App > Web

You will get configuration for your database which will contain apiKey. Just copy that value and place it in the current_key value denoted by XXX below

"api_key": [{ "current_key": "XXX" }]


For firebase migrators:

make sure you have added at least one Fingerprint in your project settings and re-download the google-services.json file


If you are using firebaes, you have to copy serverKey from the firebase to the google-services.json

 "api_key": [{ "current_key": "SERVER_KEY"}

To get the server Key, Goto ProjectOverview> Project Settings > CloudMessaging > Copy OR generate and copy serverKey..


add this into your google-service.json file . you will find it under app/google-service.json

“api_key”: [
“current_key”: ” your-google-api-key”