Missing api_key/current key with Google Services 3.0.0 and Maps API key in build.gradle
<p>my issue is quite similar to <a href="https://stackoverflow.com/questions/37317295/missing-api-key-current-key-with-google-services-3-0-0">Missing api_key/current key with Google Services 3.0.0</a> but with a further level of complexity.</p>

<p>I updated my app this morning to com.google.gms:google-services:3.0.0 and all the play-services 9.0.0 dependencies</p>

<pre><code>compile 'com.google.android.gms:play-services-analytics:9.0.0'
compile 'com.google.android.gms:play-services-ads:9.0.0'
compile 'com.google.android.gms:play-services-identity:9.0.0'
compile 'com.google.android.gms:play-services-gcm:9.0.0'
</code></pre>

<p>Now I get the infamous error </p>

<blockquote>
  <p>Error:Execution failed for task ':hotelsclick:processDebugGoogleServices'. > Missing api_key/current_key object</p>
</blockquote>

<p>This seems to be due to a missing API key in the google-services.json file (so I was told). I got a new API key from <a href="https://developers.google.com/cloud-messaging/android/client#get-config" rel="nofollow noreferrer">https://developers.google.com/cloud-messaging/android/client#get-config</a> and found the following field in it.</p>

<pre><code>  "api_key": [],
</code></pre>

<p>I guess I should put my Google Maps API key in there, but here it comes the double issue I'm experiencing:</p>

<p>1- if I try and put the key inside that field, it doesn't work. I tried with both</p>

<pre><code>  "api_key": [{ "current_key": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-AE" }],
</code></pre>

<p>and</p>

<pre><code>  "api_key": ["XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-AE"],
</code></pre>

<p>the error remains the same.</p>

<p>2- I've been using gradle in order to use dynamic building. I put the following in my module build.gradle:</p>

<pre><code>buildTypes {
    release {
        minifyEnabled true
        shrinkResources true
        debuggable false
        resValue "string", "google_maps_api_key", "ABCDEFGHILMNO... my maps release API key"
        proguardFiles getDefaultProguardFile('proguard-android.txt'),
                'proguard-rules.pro'
        zipAlignEnabled true
    }
    debug {
        resValue "string", "google_maps_api_key", "ZNTMRNCDNR... my google maps debug API key"
        debuggable true
        proguardFiles getDefaultProguardFile('proguard-android.txt'),
                'proguard-rules.pro'
    }
}
</code></pre>

<p>In the Androidmanifest.xml file I have</p>

<pre><code>    &lt;meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="@string/google_maps_api_key" /&gt;
</code></pre>

<p>Now, it's always been working until I updated to Google Services 3.0.0, I don't get why it doesn't work now. Shouldn't it grab the right API key from the compiled build.gradle file and put it in the manifest?</p>

<p>So my double question is: why doesn't the dynamic API key fetching work anymore? And how can I fix this?</p>

<p>Thank you</p>