ywj7931 ywj7931 - 1 year ago 124
Android Question

Facebook Android Release hash key

I have no problem login with facebook using Development key and running debug apk.
But when I generate release apk and run on the device, it shows

"Invalid key has, the key hash xxxxxxxxxx does not match any stored key hashes"

I actually added the release key on console, and that key does not match the key above, even I typed the key shown above, it does not work,
I used the following command to generate release key:

keytool -exportcert -alias androiddebugkey -keystore C:\Users\ywj7931\.android\debug.keystore | C:\Users\ywj7931\Downloads\openssl-0.9.8e_X64\bin\openssl sha1 -binary | C:\Users\ywj7931\Downloads\openssl-0.9.8e_X64\bin\openssl base64

Is it because my app is not published on google play or not reviewed by facebook yet?

Answer Source

You need to get your Production Hash key and add it to your Facebook Hash Keys in Facebook Console.

keytool -exportcert -alias <RELEASE_KEY_ALIAS> -keystore <RELEASE_KEY_PATH> | openssl sha1 -binary | openssl base64

After you get the key you can add it in your Facebook App Page.

or you can get it like below in the prod apk which you signed with your Production Key store.

try {
         PackageInfo info = getPackageManager().getPackageInfo(
         for (Signature signature : info.signatures) {
         MessageDigest md = MessageDigest.getInstance("SHA");
         Log.d("KeyHash", "KeyHash:"+ Base64.encodeToString(md.digest(),
         Toast.makeText(getApplicationContext(), Base64.encodeToString(md.digest(),
                 Base64.DEFAULT), Toast.LENGTH_LONG).show();
         } catch (NameNotFoundException e) {

         } catch (NoSuchAlgorithmException e) {


After you get you have to add it to your hash keys in your App Page in Facebook Console.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download