Android app Key Hash doesn't match any stored key hashes

后端 未结 13 1484
后悔当初
后悔当初 2020-12-02 14:51

I have an application on production on Play Store which uses a login with the Facebook SDK. When I debug the application from Eclipse there is no problem, but when its on pr

相关标签:
13条回答
  • 2020-12-02 15:18

    I used this to show the key when I ran my app. In my case, I was getting the incorrect key hash from the keytool command. Notice that if you enter the wrong password(purposely), instead of receiving an error an incorrect key is generated. Use this to get the correct hash and see if it matches the one the in the error log

    try {
            PackageInfo info =     getPackageManager().getPackageInfo("com.package.mypackage",     PackageManager.GET_SIGNATURES);
            for (Signature signature : info.signatures) {
                MessageDigest md = MessageDigest.getInstance("SHA");
                md.update(signature.toByteArray());
                String sign=Base64.encodeToString(md.digest(), Base64.DEFAULT);
                Log.e("MY KEY HASH:", sign);
                Toast.makeText(getApplicationContext(),sign,     Toast.LENGTH_LONG).show();
            }
    } catch (NameNotFoundException e) {
    } catch (NoSuchAlgorithmException e) {
    }
    

    Also, if for some reason the above method does not work. Try using this APK to generate the correct key hash. Remember that you have to sign it with whatever certificate you are trying to retrieve(debug or release). Install it on your testing device, and run it.

    http://www.easyfacebookandroidsdk.com/download/keyhash.zip

    0 讨论(0)
提交回复
热议问题