Samuel
Samuel

Reputation: 307

Google Map not showing map for release apk

I have the problem that has been discussed here but without any solution helps me. The Google map is "gray" but just in release (when I build generate signed APK). I have tried to add API key to google_maps_api.xml under release folder but that didn't work. Also, I tried to add API right to the AndroidManifest.xml but with no result too. Thanks for the help.

Upvotes: 0

Views: 879

Answers (2)

Vladimir Jovanović
Vladimir Jovanović

Reputation: 2267

When you generated your Google maps key, did you put SHA-1 of your debug, or of your release certificate? If you put debug SHA-1, add release also.

Also, proper way to do map implementation would be to have debug/res/values/google_maps_api.xml with key for debug and another release/res/values/google_maps_api.xml with key for production. There shouldn't be key in strings.xml. More about this you can read here.

Upvotes: 2

John O'Reilly
John O'Reilly

Reputation: 10330

Are you using ProGuard? If so then you'll need to add following to your ProGuard rules file:

-keep class com.google.android.gms.maps.** { *; }
-keep interface com.google.android.gms.maps.** { *; }

Upvotes: 2

Related Questions