可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I'm trying to sign up for Android Google Maps and which requests MD5 fingerprint. How to get the fingerprint out of my application??
I'm newbie to keystore and couldn't understand a thing i find online. so simple instructions appreciated
Thanks in advance
回答1:
You will be needing two keystores.
One for debug purpose and
One for release purpose.
While you are developing your application via eclipse and debugging it on simulator or device. You will be needing debug keystores. Otherwise you will not be able to see the map.
debug keystore is already present into your system.
Try finding them at
Windows Vista: C:\Users\<user>\.android\debug.keystore
Windows XP: C:\Documents and Settings\<user>\.android\debug.keystore
OS X and Linux: ~/.android/debug.keystore
Open console/terminal on to the above location where debug.keystore file is present and execute
keytool -list -keystore debug.keystore
Output will be like (press simply enter when password is asked)
rohit@Desktop:~/.android$ keytool -list -keystore debug.keystore
Enter keystore password:
***************** WARNING WARNING WARNING *****************
* The integrity of the information stored in your keystore *
* has NOT been verified! In order to verify its integrity, *
* you must provide your keystore password. *
***************** WARNING WARNING WARNING *****************
Keystore type: JKS
Keystore provider: SUN
Your keystore contains 1 entry
androiddebugkey, 19 Apr, 2011, PrivateKeyEntry,
Certificate fingerprint (MD5): 00:35:C2:48:65:43:CG:55:41:11:16:F1:4C:11:82:C5
rohit@Desktop:~/.android$
Copy this MD5 fingerprint value and go to
http://code.google.com/android/maps-api-signup.html
You will get Map Keys On successful signup. Put those in the MapView Element of your view.
For release
You need to generate your own keystore and need to get Map keys for the same.
else you will not be able to see map on deployment of your apk onto the device.
Create a new keystore of your own and follow the same procedure for the generated keystore.
Its very easy to generate keystore also.
I simply export my android application via eclipse and it then do everything by itself.
Hope it helps :)
回答2:
http://code.google.com/android/add-ons/google-apis/mapkey.html#getfingerprint
If you follow this correctly, you should be able to get your MD5 fingerprint. There are instructions to both get your fingerprint at the time of signing as well as afterwards.
If you've signed already:
You would first use your command prompt to navigate to your debug keystore in your automatically made profile android folder as described in the link. You would then paste this (without the dollar sign) and run it in your command prompt:
$ keytool -list -alias androiddebugkey -keystore <path_to_debug_keystore>.keystore \
-storepass android -keypass android
Otherwise, you can use your command prompt to navigate to your jarsigner in your Java SDK folder and use this:
$ keytool -list -alias alias_name -keystore my-release-key.keystore
After following the on prompt instructions, you should receive your MD5
回答3:
Anyone coming here looking for the
MD5 or SHA1 for the YouTube OAuthAPI this is the command:
Windows Vista: C:\Users\<user>\.android\debug.keystore
Windows XP: C:\Documents and Settings\<user>\.android\debug.keystore
OS X and Linux: ~/.android/debug.keystore
This cmd:
keytool -exportcert -alias androiddebugkey -keystore path-to-debug-or-production-keystore -list -v
The default password for the debug.keystore is android
Taken from
YouTube API
回答4:
Wow I would have never gotten it with the answers above, had to read a book tutorial which is CLEAR finally!
The filename of the debug keystore is debug.keystore. This is the certifi cate that Eclipse uses to sign
your application so that it may be run on the Android Emulator or devices.
Using the debug keystore, you need to extract its MD5 fi ngerprint using the Keytool.exe application
included with your JDK installation. This fi ngerprint is needed to apply for the free Google Maps
key.
You can usually find the Keytool.exe in the C:\Program Files\Java\\bin
folder.
Issue the following command (see Figure 9-4) to extract the MD5 fi ngerprint:
keytool.exe -list -alias androiddebugkey -keystore
“C:\Users\.android\debug.keystore” -storepass android
-keypass android
回答5:
The following may be able to help you:
public String convert(String str){
String a=null;
char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'a', 'b', 'c', 'd', 'e', 'f' };
try {
a=new String(str.getBytes("ISO8859_1"),"UTF-8");
byte[] strTemp = str.getBytes();
MessageDigest mdTemp = MessageDigest.getInstance("MD5");
mdTemp.update(strTemp);
byte[] md = mdTemp.digest();
int j = md.length;
char str1[] = new char[j * 2];
int k = 0;
for (int i = 0; i < j; i++) {
byte b = md[i];
//System.out.println((int)b);
str1[k++] = hexDigits[b >> 4 & 0xf];
str1[k++] = hexDigits[b & 0xf];
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return new String(str1);
}
回答6:
For Windows Users: If you have problems, make sure there are no other debug.keystore files around. I followed the instructions, but only managed to get it to work when I discovered my Eclipse installation was using a different debug.keystore located here:
android-sdk-windows.android
(not the one in my Windows User directory)
回答7:
2015 Update:
Make sure your are currently in jdk/bin
in your terminal
For Linux or OS X, open a terminal window and enter the following:
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
For Windows Vista and Windows 7, run:
keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android
If you are successful in above step you will get:
Alias name: androiddebugkey
Creation date: Jan 01, 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: 4aa9b300
Valid from: Mon Jan 01 08:04:04 UTC 2013 until: Mon Jan 01 18:04:04 PST 2033
Certificate fingerprints:
MD5: AE:9F:95:D0:A6:86:89:BC:A8:70:BA:34:FF:6A:AC:F9
SHA1: BB:0D:AC:74:D3:21:E1:43:07:71:9B:62:90:AF:A1:66:6E:44:5D:75
Signature algorithm name: SHA1withRSA
Version: 3