Facebook的SDK 3.0的androidSDK、Facebook、android

2023-09-08 00:28:08 作者:良人

我已经通过教程转眼就developer.facebook.com基本的Hello World的Facebook应用程序为Android无数次,以确保我不是犯了一个错误,但我得到的错误remote_app_id不匹配存储的ID,但它确实匹配不知道为什么它是抛出这个错误。此外,当我运行的样本,我收到了失败的粘合剂的事务。现在什么奇怪的是,如果我卸载应用程序的FB我的手机上,并强制用户登录到Facebook上的基本的Hello World程序的作品。难道我做错了什么,或者这是一个Facebook SDK的问题。我已经下载并重新安装一切,但仍然得到了同样的问题。

I have gone through the tutorials on developer.facebook.com for basic hello world facebook app for android countless times to make sure im not making a mistake but I get the error "remote_app_id does not match stored id" but it does match and not sure why it is throwing that error. Also when i run the samples i get a failed binder transaction. Now whats strange is if i uninstall the fb app on my phone and force the user to sign in to facebook the basic hello world app works. Am I doing something wrong or is this a facebook sdk problem. I have already downloaded and reinstalled everything but still getting the same problem

推荐答案

尝试

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

} catch (NoSuchAlgorithmException e) {

}

在您的主要活动:-)这是它为我的作品为Android SDK 3.0

in your main Activity :-) This is the only solution it works for me for Android SDK 3.0