简体   繁体   中英

Android Studio - Google Maps API works for debug version but not for release version

I've built an app that contains a Map from Google Maps API. When I was trying it, and debugging directly from Android Studio, all worked fine Now I released the app, and in the release version, the map is not displayed anymore, only the location-button is displayed.

Do I need a new google maps api key for the release version in \\app\\src\\release\\res\\values\\google_maps_api and if I do so, how do I get the right key?

Or is there another problem with the release version?

You need to Release key for your application :

  1. Create your own signing key that you will use for publishing, using Keytool : http://developer.android.com/guide/publishing/app-signing.html#cert

  2. Get the MD5 fingerprint of your newly generated key : https://developers.google.com/maps/documentation/android/mapkey#getfingerprint

  3. Submit the signature to this link to get your Google Maps key : https://developers.google.com/android/maps-api-signup?hl=fr

  4. Export your application with your newly created key, in Eclipse : right click on your projet -> Android Tools -> Export signed application package.

Careful to keep your certificate in a safe place, because you will need it if you want to publish an update of your app on Google Play.

If you use App Signing by Google Play( https://support.google.com/googleplay/android-developer/answer/7384423 )

You need another API KEY Application restrictions : not from your debug, release keystore, but form Google Play Console -> Release management -> App signing -> App signing certificate -> SHA-1 certificate fingerprint.

Good Luck.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM