11

I'm currently developing an application for Android and I'm using Google Maps API. In developer console, I added my SHA1 certificate print, followed by my package name. Even though I put this SHA1 certificate print using keytool, I can't access to the maps. I made lots of search, but every topics brought me to answers where error were in a wrong API Key in developer console. But I took the right SHA1, the one of my certificate.

Thanks in advance !

  • 1
    did you mention android key in manifest file – Rahul Chaudhary Aug 05 '15 at 13:55
  • Does this answer your question? [Android Studio - Google map still blank on real Android device on release apk](https://stackoverflow.com/questions/30559602/android-studio-google-map-still-blank-on-real-android-device-on-release-apk) – Sweta Jain Nov 10 '21 at 13:13

5 Answers5

22

My Map in release mode was showing but after I publish to Play Store it was not showing.

I had mentioned both debug and release certificate SHA-1 Key to Google Developer Console but map in release mode after downloading app from play store was still not showing.

Here' what was problem: Google Play App Signing is enabled for this app

Goto Release Management -> App Signing -> and copy the SHA-1 certificate fingerprint from App signing certificate

Or Release -> Setup -> App Integrity -> App Signing

enter image description here

Paste this newly copied SHA-1 fingerprint to Developer Console and map in release mode will show.

Shahab Rauf
  • 3,651
  • 29
  • 38
Noor Ali Butt
  • 798
  • 8
  • 24
  • I've been stuck on this for 3 days! Thank-you so much, nowhere in the doco have I seen this step illustrated. – ngatirauks May 14 '18 at 00:30
  • I was using `keytool` to get the SHA-1 from the terminal inside Android Studio, but the map still wasn't working with this SHA-1. Thanks for this! It seems like the `release` SHA-1 from Android Studio was different that the one in the Google Play console. – David A Jun 11 '18 at 21:15
  • 2
    I was also stuck on this for days. Thank you! The hash in the Play Console was clearly different than the one from the command-line keytool. The keytool was showing the upload certificate. – Dennis Calla Aug 14 '18 at 22:56
  • very annoying that the description for both `app signing key` and `upload key` are basically the same – lasec0203 Apr 28 '21 at 22:14
8

I had this same problem, it was super frustrating. What I ended up doing was taking the key I made using my release keystore and putting it in the google developers console. Then, added the following into the android manifest.

<meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="KEY GOES HERE"/>

I'm sure you read the documentation on this, but make sure you follow the instructions for the release certificate to the dot.

https://developers.google.com/maps/documentation/android/signup

You could also follow the link that was generated for you in the google_maps_api.xml file. This automates the process of entering the key into the developer console. However, make sure you still add that meta data value into your manifest.

Andrew Brooke
  • 12,073
  • 8
  • 39
  • 55
  • 3
    Thanks! I made the change, and I also noticed that when I created my Google Maps activity, there were two places where the API Key is store. One file for release, and another one for debug. Be sure the key is specified in these two files! – Alexandre Daubois Aug 05 '15 at 15:19
  • 3
    I have been looking for those two files, they're just in src/debug/res/values/google_maps_api.xml and src/release/res/values/google_maps_api.xml – Karl John Hernandez Oct 27 '15 at 12:49
7

The file google_maps_api.xml has to be under res/debug/ and res/release. The editor only shows your current run configuration which is debug by default and is a bit misleading if you do not observe the (debug) note after the folder name. Copy the google_maps_api.xml into both folder and edit make sure they have the correct API keys ofr each build.

Vishwa Kiran
  • 151
  • 1
  • 4
1

Android Studio also creates a TODO in the release folder for the google_maps_api xml file and lets you know of the required procedure before release. Also please do not change the key in manifest manually. When you switch to a release variant, the key is automatically updated in the manifest.

In any case do this,

  1. Go to the link as mentioned by @Andrew Brook

  2. Click "Get a key" and continue

  3. Either create a new project or use an existing one
  4. Specify the options and click the button
  5. If you already had made one before, for let's say for debug, then go to Create a new api key Image here
  6. Add the required name, click on "Add package name and fingerprint"
  7. Add your app's package name and SHA-1 key (generete it using keytool in java/jdk../bin/) Image here
  8. You get your "release" variant API key to be added in the google_maps_api.xml in the release folder.
habla2019
  • 93
  • 1
  • 9
0

You have to Enable the SHA key In Google Developer Console so at 1st go to release Management get your app SHA key (1st one ) then Follow this link

 https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend&keyType=CLIENT_SIDE_ANDROID&r=(Your SHA KEY)%3B(YOUR PACKAGE NAME)

Now it Will Enable the API . now update your app with the new key . It will Work .