0

I have an app with facebook integrated. it works fine when i run it from eclipse but after signing the application i get this error

 Login failed: invalid_key:Android key mismatch.
Your key "JGn9F2vDQ/w6hexLxdefCUpxYIA" does not match the allowed keys specified in your application settings.
Check your application settings at http://www.facebook.com/developers

I have checked key hash generated by my application and one on www.facebook.com/developers is same. Please help!

Saad Asad
  • 2,528
  • 3
  • 20
  • 27

2 Answers2

0

You can try this for generating hash key:

 // Put this code on oncreate method

try {
    //Replace your.package.name with your base packege name.
    PackageInfo appPkgInfo = getPackageManager().getPackageInfo("your.package.name", PackageManager.GET_SIGNATURES);


    for (Signature signature : appPkgInfo.signatures) {

        MessageDigest messageDigest = MessageDigest.getInstance("SHA");
                md.update(signature.toByteArray());

        // See Logcat for your hash key and put in on Facebook developer console.
        Log.d("Your Hash key", Base64.encodeToString(messageDigest.digest(), Base64.DEFAULT));
    }
    } catch (NameNotFoundException e) {

    Log.e("ERROR",e.getMessage());

    } catch (NoSuchAlgorithmException e) {

    Log.e("ERROR",e.getMessage());

}
Lavekush Agrawal
  • 6,040
  • 7
  • 52
  • 85
0

This was resolved by generating hashkey from my keystore generated after signing my apk.

i used this this answer to generate hashkey from keystore. thanks to him :)

Community
  • 1
  • 1
Saad Asad
  • 2,528
  • 3
  • 20
  • 27