veerendra
veerendra

Reputation: 523

Key Hash is different from release key and debug keystores in android

I am using an facebook sdk in my application.For that I have generated key hashes using both debug.keystore and release keystore. I have added both the keyhashes in developer page for my application. But still I am getting error like

com.facebook.http.protocol.ApiException: Key hash "LLSiRNj0hXH8BQpUJivI0UJz00Q" does not match any stored key hashes.

But the keyhash given in above error message does not belongs to any of my keyhashes generated. I did not understand how this keyhash will be generated and where it came from.

I have also added keyhash generated by the below code in my developer page.

The keyhash in error message does not matches to any of these 3 keyhashes(debug keystore,release keystore, keyhash by below code)

code:

try {
        PackageInfo info = getPackageManager().getPackageInfo(
        "com.bloopit.activities", 
        PackageManager.GET_SIGNATURES);
          for (Signature signature : info.signatures) {
           MessageDigest md = MessageDigest.getInstance("SHA");
           md.update(signature.toByteArray());
           System.out.println("KeyHash : "+ Base64.encodeToString(md.digest(), Base64.DEFAULT));
            }

I just wants to know where the keyhash in error message came from? I added the keyhash to my developer page and it is working well,but I didnt know whether it is correct process or not.

will it leads to any problems?

Thanks } catch (NameNotFoundException e) { } catch (NoSuchAlgorithmException e) { }

Upvotes: 2

Views: 1549

Answers (1)

Biraj Zalavadia
Biraj Zalavadia

Reputation: 28484

For Linux

Open Terminal :

For Debug Build

keytool -exportcert -alias androiddebugkey -keystore debug.keystore | openssl sha1 -binary | openssl base64

you wil find debug.keystore from ".android" folder copy it from and paste on desktop and run above command

For release Build

keytool -exportcert -alias <aliasName> -keystore <keystoreFilePath> | openssl sha1 -binary | openssl base64

NOTE : Make sure In Both case it must ask for password. If it does not asks for password that means something is wrong in command.

Upvotes: 1

Related Questions