0

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.

Vladimir Jovanović
  • 2,261
  • 2
  • 24
  • 43
Sam
  • 308
  • 1
  • 3
  • 14

2 Answers2

2

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.** { *; }
John O'Reilly
  • 10,000
  • 4
  • 41
  • 63
2

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.

Vladimir Jovanović
  • 2,261
  • 2
  • 24
  • 43