2

I am using facebook integration in to my application. But i got stop at get Hash code of the Android application. Link to get Hash code for facebook: Here.

I am using this syntex in commend prompt but got error like keytool is not recognized as an internal or external command:

D:\Users\Priyadarshan\.android>keytool -exportcert -alias androiddebugkey -keyst
ore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64
'keytool' is not recognized as an internal or external command,
operable program or batch file.

Please help me in this. Thanks.

Edited:

After seen that :This Link.

I have Done like below but still got error:

D:\Users\Priyadarshan>cd C:\Program Files\Java\jre7\bin\keytool -exportcert -ali
as androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary |
openssl base64
'openssl' is not recognized as an internal or external command,
operable program or batch file.

After Some guide I have done like below but still got error:

D:\Users\Priyadarshan>cd C:\Program Files\Java\jre7\bin\keytool -exportcert -ali
as androiddebugkey -keystore ~/.android/debug.keystore | D:\Users\Priyadarshan\o
penssl-0.9.8k_WIN32\bin\openssl sha1 -binary | D:\Users\Priyadarshan\openssl-0.9
.8k_WIN32\bin\openssl base64
The system cannot find the path specified.
2jmj7l5rSw0yVb/vlWAYkK/YBwk=
Community
  • 1
  • 1
Shreyash Mahajan
  • 23,386
  • 35
  • 116
  • 188

4 Answers4

3

I have keytool in a different directory:

C:\Program Files (x86)\Java\jre6\bin

You can either add the path where keytool is into your PATH environment variable, or you can use quotes around the full path like

D:\Users\Priyadarshan.android>"C:\Program Files\etc\keytool.exe" -exportcert etc etc

Don't forget the quotation marks because of spaces in the path!

brianestey
  • 8,202
  • 5
  • 33
  • 48
2

keytool comes with the JDK.

You'll find it, assuming you installed the JDK with default settings, at C:\Program Files\Java\jdk1.6.0_23\bin\keytool.exe

Paresh Mayani
  • 127,700
  • 71
  • 241
  • 295
1

THE Coder from facebook documentation to get the hash code just run it in the emulator

   try {
            PackageInfo info = getPackageManager().getPackageInfo(getPackageName(), 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));
                   //Toast.makeText(StartingPlace.this, something,
                        //  Toast.LENGTH_LONG).show();
                    Log.e("hash key", something);
        } 
        }
        catch (NameNotFoundException e1) {
            // TODO Auto-generated catch block
            Log.e("name not found", e1.toString());
        }

             catch (NoSuchAlgorithmException e1) {
                // TODO Auto-generated catch block
                 Log.e("no such an algorithm", e1.toString());
            }
             catch (Exception e1){
                 Log.e("exception", e1.toString());
             }
        //code to get hash code
0

You can use Open SSL from this link,
this issue is discussed in this post

Community
  • 1
  • 1
Alex
  • 1,068
  • 8
  • 23