I am able to view google maps on Emulators and on my device when USB debugging is enabled. But when I try to generate a debug / release apk and install the apk on my device, I am unable to view the maps.
I have done the following:
a) Generated API Key in https://console.developers.google.com/ and have copied it into google_maps_api.xml of my project.
b) I have generated the necessary SHA key using the following command.
keytool.exe -list -v -alias <myalias> -keystore <my path> -storepass <passwd> -keypass <passwd>
What I am not able to understand is, how do I use the generated SHA?
As per Release APK file not showing google maps I am supposed to add the SHA key into my API key on https://console.developers.google.com/. But, I see no such option to add it.
By installing the apk and then debugging the installed code on an emulator, I see the following exception:
API Key must not be empty.
My google_maps_api.xml is as follows:
<resources>
<string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">Have added my api key here</string>
Have added my api key here --> This is where I have added the API ket that I have generated.
Have added this into my manifest file:
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
Can someone help me out in understanding what is it that I am supposed to do?