2012-03-11 144 views
7

我想在我的應用程序中使用Google Maps,我已經按照this教程來生成我的eventappkey.keystore的MD5指紋。但keytool會生成SHA1指紋而不是MD5,因此我無法註冊Google API,因爲Google接受密鑰庫的MD5指紋。Keytool生成SHA1指紋而不是MD5?

Command line snapshop (Window 7)

我已經看過這建議使用JDK1.6其他的答案。但有沒有更好的方法,以便我不需要移動到jdk1.6。任何建議將不勝感激。

+1

看看這個 [鏈接](H TTP://stackoverflow.com/questions/6305938/how-can-i-get-the-md5-fingerprint-from-javas-keytool-not-only-sha-1) – 2012-03-11 10:27:40

回答

20

如果添加了-v(詳細)選項,命令行,像

keytool -v -list -alias alias_name -keystore my-release-key.keystore 

它應該告訴你的MD5指紋

1
Syntax: 

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

Example: 


C:\Program Files\Java\jdk1.7.0_71\bin>keytool -list -v -keystore c:\users\your_u 
ser_name\.android\debug.keystore -alias androiddebugkey -storepass android -keyp 
ass android 
keytool error: java.lang.Exception: Keystore file does not exist: c:\users\your_ 
user_name\.android\debug.keystore 
java.lang.Exception: Keystore file does not exist: c:\users\your_user_name\.andr 
oid\debug.keystore 
     at sun.security.tools.KeyTool.doCommands(KeyTool.java:738) 
     at sun.security.tools.KeyTool.run(KeyTool.java:340) 
     at sun.security.tools.KeyTool.main(KeyTool.java:333) 

C:\Program Files\Java\jdk1.7.0_71\bin>keytool -list -v -keystore C:\Users\sriniv 
as\.android\debug.keystore -alias androiddebugkey -storepass android -keypass an 
droid 
Alias name: androiddebugkey 
Creation date: Apr 8, 2015 
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: 4e7c69e7 
Valid from: Wed Apr 08 15:17:20 IST 2015 until: Fri Mar 31 15:17:20 IST 2045 
Certificate fingerprints: 
     MD5: 9D:C3:05:CB:FF:CA:06:31:8C:FC:FE:44:6C:94:BC:90 
     SHA1: 2F:88:EF:9D:1B:3E:35:87:18:7D:56:B5:95:83:9A:EF:C1:B3:25:B4 
     SHA256: 0F:D2:BC:2C:58:1B:16:3D:E3:5C:76:7D:C3:49:3A:A0:9D:95:4E:3E:6B: 
71:0B:F7:2B:23:72:54:B8:57:62:A2 
     Signature algorithm name: SHA256withRSA 
     Version: 3 
0

如果採用Android工作室,然後用這個方法:

enter image description here