21

I am trying to get my debug.keystore md5 key so I can get the API key for Google Maps.

I run the command:

 keytool –genkeypair -alias armand -keypass pass

And then running the command:

keytool -list -alias armand -keystore debug.keystore

I then enter my password and it gives me the following error:

keytool error: java.lang.Exception: Alias <armand> does not exist

What am I doing wrong?

Eric Leschinski
  • 146,994
  • 96
  • 417
  • 335
Armand
  • 9,847
  • 9
  • 42
  • 75

3 Answers3

28

This is right a way to get key:

To get certificate fingerprint (MD5) follow the steps below:

You need to get the keystore file for getting the certificate fingerprint (MD5). Your keystore file can be found at the following path:

C:\Documents and Settings\<username>\Local Settings\Application Data\Android

(Or)

C:\Documents and Settings\<username>\.android

Keystore file name is debug.keystore. Copy the "debug.keystore" file to some other folder (ex: - "D:\Androidkeystore\") (it's user friendly to use). Open command Prompt and go to the Java installed directory. ("C:\Program Files\Java\\bin") Then type the below line (given in box) and press enter.

keytool.exe -list -alias androiddebugkey -keystore "D:\AndroidKeystore\debug.keystore" -storepass android -keypass android

Here the MD5 certificate fingerprint is

64:88:A2:FC:AA:9F:B1:B0:CA:E4:D0:24:A8:1E:77:FB

This is working, but I am getting small error here:

this is my path-C:\ANDROID\Java\jdk1.6.0\bin>keytool.exe -list -alias androiddebugkey -keystore"C:\ANDROID\debugkey\debug.keystore"-storepass android -keypass android

keytool error: java.lang.RuntimeException: Usage error, android is not a 
legal command
Eric Leschinski
  • 146,994
  • 96
  • 417
  • 335
Nikunj Patel
  • 21,853
  • 23
  • 89
  • 133
  • @Dr.nik hey you've just ended 2 days of hell. my map wasn't displaying, didn't know you had to run the keytool against the debug.keystore. thanks dude:) – turtleboy Jan 20 '12 at 17:24
  • Can I apply the debug keystore to the production? As the actual keystore doesn't work (alias not found) – neobie Aug 14 '12 at 08:37
  • Pls help bro, I m getting this error- keytool error: java.lang.Exception: Alias does not exist , but I get the details if I use keytool -v -list -keystore C:\Users\User1\.android\debug.keystore – Tanvir Mar 19 '15 at 14:06
7

You are using the wrong keystore. You will have to use a different keystore.

I got this same error On Fedora, after running this command:

keytool -exportcert -alias androiddebugkey -keystore androidKey -list -v

Error:

keytool error: java.lang.Exception: Alias <androiddebugkey> does not exist
java.lang.Exception: Alias <androiddebugkey> does not exist

The mistake I made in this case was me using the keystore to sign my android APK project rather than the debug.keystore located in /home/el/.android/debug.keystore:

I changed it to use the right keystore like this:

[el@rosewill .android ]$ keytool -exportcert -alias androiddebugkey -keystore /home/el/.android/debug.keystore -list -v
Enter keystore password:  ******

And it produced this output:

Alias name: androiddebugkey
Creation date: Aug 31, 2013
Entry type: PrivateKeyEntry
Certificate chain length: 1
Certificate[1]:
Owner: CN=Android Debug, O=Android, C=US
Issuer: CN=Android Debug, O=Android, C=US
Serial number: 14be2b38
Valid from: Sat Aug 31 21:43:47 EDT 2013 until: Mon Aug 24 21:43:47 EDT 2043
Certificate fingerprints:
         MD5:  47:D1:3C:AD:3C:6D:49:22:26:01:6B:C8:4D:C0:37:42
         SHA1: 10:96:22:A1:3C:3B:4A:14:2D:B7:5E:62:1D:D7:9B:0B:24:EE:DF:BD
         SHA256: DF:BF:A9:5D:B8:AE:7D:FF:7E:E7:62:84:8F:32:9A:29:19:C6:41:82:83:FA:0B:D0:1B:59:15:AE:4D:D8:38:D1
         Signature algorithm name: SHA256withRSA
         Version: 3

Extensions: 

#1: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: 1A 32 1F F0 03 E0 23 34   6F GE 78 CC E3 10 B5 61  .0....)4o.x....a
0010: 6D 6F F1 38                                        mo.8
]
]

For reference, these were the directions I was following:

From here: https://developers.google.com/+/quickstart/android

In a terminal, run the the Keytool utility to get the SHA-1 fingerprint of the certificate. For the debug.keystore, the password is android.

keytool -exportcert -alias androiddebugkey -keystore <path-to-debug-or-production-keystore> -list -v
Eric Leschinski
  • 146,994
  • 96
  • 417
  • 335
2

This is what worked for me, first go to your JDK/bin dir, in my case this is C:\Program Files\Java\jdk-12.0.1\bin, click on dir path and write cmd to open command prompt or simply open cmd and navigate to your JDK\bin dir.

Then write:

keytool -list -v -alias androiddebugkey -keystore %USERPROFILE%\.android\debug.keystore

When prompted for password write: android

Trax
  • 1,445
  • 5
  • 19
  • 39