我在 Google Play 上上传了我完全正常工作的应用程序,当从那里下载时,facebook 登录不起作用!我正确配置了我的 facebook 应用程序并使用 eclipse 环境。搜索后,可以通过 facebook key hashes 完成。但是,我得到了它:
如何在 Mac 中为 facebook SDK 生成密钥哈希
似乎还必须获得分发的密钥哈希......但是如何?谢谢你。
我在 Google Play 上上传了我完全正常工作的应用程序,当从那里下载时,facebook 登录不起作用!我正确配置了我的 facebook 应用程序并使用 eclipse 环境。搜索后,可以通过 facebook key hashes 完成。但是,我得到了它:
如何在 Mac 中为 facebook SDK 生成密钥哈希
似乎还必须获得分发的密钥哈希......但是如何?谢谢你。
备选方案 1:
将此与使用您的发布密钥签名的应用程序一起使用。不是从 Eclipse 部署的那个。
在应用的第一个 Activity 中运行这段代码:
try {
PackageInfo info = getPackageManager().getPackageInfo(
"YOUR_PACKAGE_NAME", PackageManager.GET_SIGNATURES);
for (Signature signature: info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
Log.e("FACEBOOK APP SIGNATURE", Base64.encodeToString(md.digest(), Base64.DEFAULT));
}
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
此行:Log.e("FACEBOOK APP SIGNATURE", Base64.encodeToString(md.digest(), Base64.DEFAULT));
将在 DDMS 中记录 Key Hash。
备选方案 2:
C:\Program Files\Java\jre7\bin
openssl sha1 -binary debug.txt > debug_sha.txt
进而,
openssl base64 -in debug_sha.txt > debug_base64.txt
完毕!debug_base64.txt包含您的密钥哈希。将其复制到您的应用程序控制台中,一切就绪。
In my experiece, both the methods have given me the correct Key Hash. However, in a few cases (rather random ones), the first alternative did not give the correct Key Hash while the second alternative has always worked. See which works for you.
While generating release Hash key, Note this
When generating the hash key for production you need to use openssl-0.9.8e_X64.zip
on windows, you cannot use openssl-0.9.8k_X64.zip
The versions produce different hash keys, for some reason 9.8k does not work correctly... 9.8e does.
OR
Use this below flow
This is how I solved this problem
Download your APK to your PC in java jdk\bin folder
in my case C:\Program Files\Java\jdk1.7.0_121\bin
go to java jdk\bin
folder and run cmd then
copy the following command in your cmd
keytool -list -printcert -jarfile yourapkname.apk
Copy the SHA1 value to your clip board
like this CD:A1:EA:A3:5C:5C:68:FB:FA:0A:6B:E5:5A:72:64:DD:26:8D:44:84
and open Hex To Base 64 to convert your SHA1 value to base64.
Try this solution, for me I was getting the same error, but working fine now after trying hours.
Login Error: There is an error in logging you into this application. Please try again later