0

I generated 2 API keys in API console, one for debug with debug SHA1(no restriction) and one for production with release keystore SHA1(with Android Apps Restriction).

I have both the API key seperately in debug..\google_maps_api.xml and release..\google_maps_api.xml and added the metadata in Manifest above the closing application tag. I generated a signed APK and the maps loads fine. My Manifest looks like this

<application
    <activity
        android:name=".MainActivity"
        android:screenOrientation="portrait"
        android:windowSoftInputMode="stateHidden|adjustResize" />

    <meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />

    <activity
        android:name=".MapsActivity"
        android:label="@string/title_activity_maps"
        android:screenOrientation="portrait" />

    <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="@string/google_maps_key" />
</application>

I generated the signed APK using signature servions V1(Jar Signature) and V2(Full APK Signature). After Publishing in Playstore the map is not loading. Can anyone please guide me on this?.

David
  • 906
  • 3
  • 11
  • 23
  • play store creates a new SHA1 key called "App signing certificate" [enter link description here](https://stackoverflow.com/a/44330035) – Robin Mathew Jun 22 '17 at 13:24
  • hey check rhis https://stackoverflow.com/questions/39318370/google-sign-in-not-working-after-publishing-in-play-store/44330035#44330035 – Prinkal Kumar Jun 08 '18 at 19:33

2 Answers2

0

Based from this thread, when you exported your application to publish it, you are probably not using the debug keystore any more, but a custom one. When you switch to another keystore, you will have to generate a new Google Maps API Key. You need to create a release certificate fingerprints. You may check here the step to generate the release certificate fingerprints. Here's another reference which might help.

abielita
  • 13,147
  • 2
  • 17
  • 59
  • I created a seperate API key for release using the release keystore SHA. I used keytool -list -v -keystore your_keystore_name -alias your_alias_name to get the SHA – David Jun 13 '17 at 16:05
0

One solution to this problem is that IF you are using Google's App Signing, they are resigning your app for you and there is a new SHA-1 key that you need to add into API key restrictions. That is why it works when you sign and install it and not after uploading it to Play Console.

This SHA-1 can be found on https://play.google.com/console by selecting the app -> Setup -> App Integrity.

After you add this SHA-1 fingerprint to your key, the app will start working, no need for a new build.

PapaIII
  • 41
  • 7