Google Maps Android is displayed blank in Release

4

I have an app that uses google maps, in debug everything works fine, but when you move to release, the map is not displayed

the file google_maps.api.xml I created it outside of debug, that is to say I have it in main/res/values/google_maps.api.xml

in AndroidManifest.xml I assign it

<Aplication>
...

<meta-data
    android:name="com.google.android.geo.API_KEY"
    android:value="@string/google_maps_key" />
...
</aplication>

I see that within google_maps.api.xml there is the following:

  

Once you have your key (it starts with "AIza"), replace the   "google_maps_key"       string in this file.

And if it starts with AIza where do I get the key to release?

    
asked by Webserveis 20.09.2017 в 22:17
source

4 answers

3
  

I have an app that uses google maps, in debug everything works   ok, but when you move to release, the map is not displayed

Remember that when we obtain the API KEY it is related to the SHA-1 of our Keystore, in development the debug.keystore is used but for production you must obtain the SHA-1 of the Keystore with which you sign your application and register it .

You can even configure the SHA-1 development and production to work properly when you perform tests in development and when you sign with your keystore for the Google PlayStore.

It is important to note that adding a new SHA-1 generates a new API Key different.

If you do not show the map,

The main reason why the map is not displayed is because does not have the correct KEY API or the API is not enabled .:

   <application>
   ...
   ...
   <meta-data
    android:name="com.google.android.geo.API_KEY"
    android:value="@string/google_maps_key" />
   ...
   ...
   </application>

Review this question that describes your problem, and show how to set up Google Maps in an Android application:

Maps Android Studio

When you configure a correct API KEY and Enable the API, you should have no problem showing the map:

    
answered by 20.09.2017 / 22:54
source
2

Complementing solution:

Access to the signed app must be allowed through the SHA1 of the signed application.

To get the SHA1 you must use the command

keytool -list -v -keystore tu_keystore.keystore

and in the api panel of google maps add the name of the package with the SHA1, give save.

  

With saving, another google_key_map is generated, the previous key must be reset and saved again, so you can add applications that share the map key.

    
answered by 20.09.2017 в 23:14
1

It worked for me by adding a SHA-1 more (apart from the one generated with the certificate). In other words, I have 2 SHA-1 certificate fingerprints with the same package name.

You must enter the SHA-1 that appears in the application signature of the Play Store console.

I hope it works for you, it worked for me. Greetings

    
answered by 17.09.2018 в 14:23
0

When generating a Activity type Maps, DOS files are generated google_maps_api.xml, stored in TWO different folders: one for debug and another for release. I added the new google_key_map generated with the SHA-1 obtained according to the instructions provided for example in the answer accepted here. But it was included in the google_maps_api.xml file in the app / debug / res / values directory when the important thing was to include it in the directiorio app / release / res / values. I take this opportunity to thank you all the times Stackoverflow helped me.

    
answered by 11.06.2018 в 22:47