0

I had integrated facebook in my android application . Generate key using debugkeytool and it works fine on both emulator and real device.

Now i have to make release apk file and i had created keystore using eclipse android tool to export signed application package .

And using this keystore i had generated new key hash for facebook and set it on facebook developers site. but still i am not able to post on facebook wall after signing my app with my own created keystore. I had check all the steps for creating keystore and it is correct.

please help me out of this situation.

Thanks

5agado
  • 2,444
  • 2
  • 21
  • 30
inficare
  • 3
  • 1
  • 4

1 Answers1

8

I got the same error but when i checked the hash key by PackageManager i got the different hash key of the application and update it on facebook and it worked for me.

 PackageInfo info;
    try {
        info = getPackageManager().getPackageInfo("com.example.yourpackagename", PackageManager.GET_SIGNATURES);
        for (Signature signature : info.signatures) {
            MessageDigest md;
            md = MessageDigest.getInstance("SHA");
            md.update(signature.toByteArray());
            String something = new String(Base64.encode(md.digest(), 0));
            //String something = new String(Base64.encodeBytes(md.digest()));
            Log.e("hash key", something);
        }
    } 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());
    }

change your package name in the code. The hash key will be printed in the log. It may help you.

Abhishek Agarwal
  • 1,907
  • 12
  • 21
  • Yes I had the same error and when I tried this code I found that the key is different than the one I used in facebook, after that I have updated it everything worked fine. – Chris Sim May 24 '13 at 12:06
  • how i will get logcat when apk is signed with release key – Pawan Yadav May 24 '13 at 17:38
  • Before publishing the app you can show toast for hash key in the signed apk. In my case the key hash was same after signing the app. – Abhishek Agarwal May 25 '13 at 06:16