Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

google maps - How do I generate my MD5 and SHA1 thumbprints using eclipse for debug keystore (Android)

Can I generate my MD5 and SHA1 thumbprints using eclipse for my debug keystore? also is there a code for to generate my hash key for facebook as well?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

get your sha1 and md5 thumbprint for debug keystore (also works for your other keystores). Go to you package exporler in eclipse (defaults to the left side) right click it>android tools>export signed application package enter image description here

Then navigate to your debug keystore normally in your .android folder and select it

enter image description here

Then enter the password which is "android" with no quotes

enter image description here

Next it will ask for an alias click the drop down list and select androiddebugkey and again, enter android as the password.

enter image description here

Next if you scroll down it will show the MD5 and SHA1 thumb print if you scroll down

enter image description here

then just cancel and use it how you want if you want your hash key just paste this under your onCreate

REPLACE "com.you.name" to your application package name.

PackageInfo info;
try {

    info = getPackageManager().getPackageInfo( "com.you.name",PackageManager.GET_SIGNATURES);

    for (Signature signature : info.signatures)
    {
        MessageDigest md;
        md = MessageDigest.getInstance("SHA");
        md.update(signature.toByteArray());
        String something = new String(Base64.encode(md.digest(), 0));
        //String something = new String(Base64.encodeBytes(md.digest()));
        Log.e("Hash key", something);
    }

} catch (NameNotFoundException e1) {
Log.e("name not found", e1.toString());
} catch (NoSuchAlgorithmException e) {
Log.e("no such an algorithm", e.toString());
} catch (Exception e) {
Log.e("exception", e.toString());
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...