Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Google Maps not showing in signed apk V2

My Android app works fine on device without signing but Once I export signed apk file maps no more render Do we need to create new API key for release even with V2 if yes please suggest any link that I should follow to create release API key

like image 794
Sourabh Saldi Avatar asked Dec 08 '22 15:12

Sourabh Saldi


2 Answers

You don't need a separate API key for your release signing key. The only thing you need to do, is adding SHA of release key on APIs Console, so you have two lines there instead of one:

D3:49:EF:3D:0E:...:D5:5F:59:46:11:C1:85;pl.mg6.android.maps.extensions.demo
C1:3A:96:3E:F8:...:4D:F1:52:77:D0:01:0E;pl.mg6.android.maps.extensions.demo
like image 168
MaciejGórski Avatar answered Jan 01 '23 16:01

MaciejGórski


@MaciejGórski is correct. Below is small details to it.

In the Google Api console, where we have created the API KEY we have an option to add multiple finger prints to the same key. What I did was adding two SHA1 finger print for my debug keystore and release keystore and the same API key worked for me.

Note the below is for Ubuntu specifically:

  1. Get SHA1 for the debug using the below command

    keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
    
  2. For getting SHA1 for release the command changes to

    keytool -list -v -keystore /home/atul/Desktop/Learnings/Projects/TestApp/keystore.jks -alias test -storepass password -keypass password
    

where

/home/atul/Desktop/Learnings/Projects/TestApp/keystore.jks is the path where my keystore file for the signed apk is present

test is the key alias name used while genrating the signed key store

and password is the password used while signing the apk

Hope this helps. Happy coding :)

like image 24
Atul O Holic Avatar answered Jan 01 '23 17:01

Atul O Holic