0

I want to get the keyhash of my release keystore file to share with facebook app.

Fisrt, I test with the debug.keystore and I found 2 way to get it:

1 (Option 1). Using openssl on command:

keytool -exportcert -alias androiddebugkey -keystore "C:\Users\MyComputer\.android\debug.keystore" | "C:\openssl\bin\openssl" sha1 -binary | "C:\openssl\bin\openssl" base64

Password: android

I got Key 1: 6MrZUeEW/uRAVAd-----p5iSsnU=

2 (Option 2). Use this code

try {

        PackageInfo info = getPackageManager().getPackageInfo(
                "my_project", PackageManager.GET_SIGNATURES);
        for (Signature signature : info.signatures) {
            MessageDigest md = MessageDigest.getInstance("SHA");
            md.update(signature.toByteArray());
            Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
            }
    } catch (NameNotFoundException e) {

    } catch (NoSuchAlgorithmException e) {

}

I got Key 2: k6DGV3glG4iE7t-----vrrwz4ZI=

I don't know how it gets 2 different keyhash from 1 keystore. I set up each key to my facebook app and debug. Result: Key 1 - Can't share, Key 2 - Good Sharing.

That's keyhash of debug keystore.

Now I want to get keyhash of my release keystore, but I just get it by using Option 1, Option 2 can't get keyhash of release keystore. And like my worry, the keyhash I used Option 1 to get was not working.

Now I don't know how to get the true keyhash of my release keystore. I can't use new keystore because I can't use the .apk file which built from it to upload to Google Play. Please help me!

Thank you very much!

Thế Anh
  • 21
  • 2

0 Answers0