Facebook Integration in Android Application

前端 未结 1 1015
感情败类
感情败类 2020-12-03 16:37

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

相关标签:
1条回答
  • 2020-12-03 17:09

    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.

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