Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android SHA1 release keystore not working with Google Maps

I am using the Google Maps Android API and I'm running into some issues.

I am signing my apk with android studio (created one at .android/keystore.jks). Also I'm selecting "release" as type in it. I have used the command

keytool -list -v -keystore C:\Users\Toshiba\.android\keystore.jks 

to get the SHA1 fingerprint out of the keystore.

The SHA1 is correct, but the Map is not shown on a signed APK. It is shown in a debug APK.

Using keytool with the release keystore (keystore.jks) will get me this:

 SHA1: 33:46:07:82:5B:D4:45:D2:60:CE:5A:29:97:9F:6C:44:XX:XX:XX:XX 

The debug one works fine (I have added 2 to the API console in Google)

33:46:07:82:5B:D4:45:D2:60:CE:5A:29:97:9F:6C:44:XX:XX:XX:XX;yac.breakingpoint 7C:28:61:5B:C3:4A:5C:50:44:AA:FD:58:69:E9:70:91:XX:XX:XX:XX;yac.breakingpoint 

XX is blacked out.

The keytool says it is using SHA256withRSA as signature algorithm for both, the debug and the release keystore.

What am I doing wrong?

UPDATE So I've tried a new API key, clean project and rebuild it, new keystore - still not working on release... debug is fine!

UPDATE 2 Still not found a working solution... Help me!

UPDATE 3 Allright, got it working using a signed APK with build type debug. Extracted the CERT.RSA and runned keytool -printcert -file ./CERT.SA. Got the same result as for the release build type. In release it is not working!

UPDATE 4 Here's another try I made:

  • Created a new GIT Repository, commited to it.
  • The /buildfolders are not beeing commited since they are in the .gitignore files.
  • Created a new API key in the API console and added only the release SHA1 key to it.
  • Added that API key to the app and made a full clean with rebuild.
  • Generated a new signed APK file

It did not work.

UPDATE 5 A friend of mine tried to reproduce this issue. He has the exact same issue when working with android studio. Probably a android studio bug?

like image 687
amahrt Avatar asked Sep 16 '14 11:09

amahrt


People also ask

Where do I put SHA1 on Google console?

If you've published your app using Play App Signing, a requirement when using Android App Bundle, you can get your SHA-1 from the Google Play Console on the Release > Setup > App Integrity page.

What is the use of SHA1 key in Android?

Uses of SHA-1 key: It is used for Cryptography. By using this key the input data is converted into a 160-bit hash value which is difficult to decode.


1 Answers

You have two google_maps_api.xml files

One in this folder:

app/src/debug/res/values

Other in this folder:

app/src/release/res/values

But only the debug one contains your API key probably.

like image 121
suhaig Avatar answered Oct 17 '22 02:10

suhaig