1
C:\Documents and Settings\Admin\ keytool -export -alias androiddebugkey -keystore "C:\Documents and Settings\Admin\.android\debug.keystore" | D:\openssl\bin\openssl.exe sha1 -binary | D:\openssl\bin\openssl.exe enc -a 

I just run the above code for generating the hash key but it shows some errors...like

The filename ,directory name,or volume label syntax is incorrect
Vigbyor
  • 2,334
  • 4
  • 18
  • 34
Manu
  • 219
  • 1
  • 5
  • 14

1 Answers1

2

You may check this link below for step by step tutorial

How to get Key Hashes for android-facebook app

If you still have the same problem then you may use the below code snippet to generate keyhash. This works perfectly fine for me.

PackageInfo packageInfo;
        try {
        packageInfo = getPackageManager().getPackageInfo("com.yourapp", 
PackageManager.GET_SIGNATURES);
        for (Signature signature : packageInfo.signatures) {
                MessageDigest md = MessageDigest.getInstance("SHA");
                md.update(signature.toByteArray());
                String key = new String(Base64.encode(md.digest(), 0));
                // String key = new String(Base64.encodeBytes(md.digest()));
                Log.e("Hash key", key);
        } 
        }
        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());
        }
Nilanchal
  • 5,842
  • 8
  • 39
  • 69
  • You may want to *explicitly* state that the code here came from the blog to which you link in the second line. It is **very good** that you provide a link to where you got the code. This code has been copied many times. You are only the second person I've seen that has bothered to state/imply the code came from somewhere else. – Makyen Feb 12 '17 at 07:32