3

我在 Google Play 上上传了我完全正常工作的应用程序,当从那里下载时,facebook 登录不起作用!我正确配置了我的 facebook 应用程序并使用 eclipse 环境。搜索后,可以通过 facebook key hashes 完成。但是,我得到了它:

如何在 Mac 中为 facebook SDK 生成密钥哈希

似乎还必须获得分发的密钥哈希......但是如何?谢谢你。

4

3 回答 3

3

备选方案 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:

  1. 下载适用于 Windows 的 OpenSSl并将 .zip 解压缩到一个简单的位置,例如:c:\openssl,并在此文件夹的根目录中提取 zip 的所有内容。
  2. 将您的签名密钥文件复制到 JRE 安装的 bin 文件夹中。例如,在我的情况下:C:\Program Files\Java\jre7\bin
  3. 在复制签名密钥的 bin 文件夹中时,按SHIFT+ 右键单击​​ -> 在此处打开命令窗口。
  4. 运行以下命令:keytool -exportcert -alias YOUR_ALIAS -keystore YOUR_SIGNING_KEY > c:\openssl\bin\debug.txt
  5. 输入签名密钥的密码
  6. 现在,导航到 c:\openssl\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.

于 2013-07-21T09:15:46.563 回答
1

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.

于 2019-08-14T12:47:41.090 回答
0

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

于 2019-10-22T11:33:45.903 回答