androidgoogle-mapsgoogle-play-consolerelease-builds

Android Google Maps is blank in Signed APK


I have a Google Maps API Key and it is in both my debug and release google_maps_api.xml files.

The app and map within it work when debugging on a simulator or device. However, when I Generate a signed APK and install it onto a real device, the map is empty, as if there is no Google maps API key specified.

I have tried using the answers on here but non seem to work, at least as far as my experience with Google Play, Android studio, and release builds is allow.

I have gone into Google Play Console and Let Google handle my certificates (or something like that). I now have a list containing MD5 certificate fingerprint SHA-1 certificate fingerprint SHA-256 certificate fingerprint and a button titled [DOWNLOAD CERTIFICATE] (app signing certificate) but have no idea what to do with those... if Im supposed to do anything with them at this point.

What do I do next to get the map to show up on the release signed APK file? Should I plonk the app signing cert somewhere in my project?

My intent is not to release, yet. I just want to test out a release build for performance differences etc.

UPDATE 1 i have followed the following and now have my Certificate Fingerprint, but where do I place it, if at all?


enter image description here



Solution

  • Holly Molly, I ended up figuring out that the link in my dubug google_maps_api.xml contains the debug SHA-1 which it passes to Google Cloud Platform to whitelist the debug build for using the GoogleMaps api key that it will use.

    This therefore means that if you build a release APK, the SHA-1 will be different.

    How do you get the Release SHA-1? You do your Build->Generate Signed Bundle and follow the steps. Take note of where the .keystore file is saved. I used desktop.

    Once you have done that, have a look at the screenshot in my question. It states using keytool -list ...etc to view the SHA-1 for the generated APK.

    Once you have your SHA-1 showing, go to Google Cloud Platform, and into APIs, and into Maps SDK for Android. Click on the edit icon for the app that you wish to use the API for. You should now see a list titled API restrictions where there should be a list already containing the SHA-1 for your debug build.

    Copy your SHA-1 from Terminal, (found by running that keytool -list ...etc) command. Paste it as a new 'item' in that Android app restrictions list. Save, if there is a save button.

    You should be good to go from here on 👍.


    Or you could just un-restrict your API key usage, which is not recommended.