android connect facebook invalid keyhash

若如初见. 提交于 2019-12-03 23:09:58
khurram

Its because the generate hash key is wrong.

To solve follow this steps:

Paste the following code in oncreate().

try {
    PackageInfo info = getPackageManager().getPackageInfo(
            "com.example.packagename", 
            PackageManager.GET_SIGNATURES);
    for (Signature signature : info.signatures) {
        MessageDigest md = MessageDigest.getInstance("SHA");
        md.update(signature.toByteArray());
        Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
        }
} catch (NameNotFoundException e) {

} catch (NoSuchAlgorithmException e) {

}

see this thread

https://stackoverflow.com/a/23863110/2176734

this will surely solve your problem.

1.go to developer.facebook.com

2.select your application

3.Click settings

4.click Add Platform

5.add all mandatory fields

6.add your key hashes there

7.Click save changes

now check

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!