0

When I am going to generate hash key for facebook integration. I have got this error.

C:\Program Files\Java\jdk-9.0.1>keytool -exportcert -alias androiddebugkey -keys tore "C:\Users\MEGHA.android\debug.keystore" | "C:\openssl\bin\openssl" sha1 -b inary | "PATH_TO_OPENSSL_LIBRARY\bin\openssl" base64 'keytool' is not recognized as an internal or external command, operable program or batch file.

Please tell me where I am wrong. Please give me the right solution for this. Thanks in advance

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
Megha Jain
  • 21
  • 1
  • 4

2 Answers2

2

Just select gradle from left side and you will see option for signing report. Click on signing report in the below you will get debug hash key.

Azhar osws
  • 188
  • 1
  • 8
1

Use this for generate hash key

public void printHashKey() {
    // Add code to print out the key hash
    try {
        PackageInfo info = getPackageManager().getPackageInfo(
                "com.Bhomeo",
                PackageManager.GET_SIGNATURES);
        for (Signature signature : info.signatures) {
            MessageDigest md = MessageDigest.getInstance("SHA");
            md.update(signature.toByteArray());
            Log.e("KeyHash:", Base64.encodeToString(md.digest(), 
    Base64.DEFAULT));
        }
    } catch (PackageManager.NameNotFoundException e) {
        e.printStackTrace();

    } catch (NoSuchAlgorithmException e) {
        e.printStackTrace();

    }
}
mehul chauhan
  • 1,792
  • 11
  • 26