1

我有生成密钥哈希的问题。我做了2个键:

C:\openssl\bin>"C:\Program Files\Java\jre7\bin\keytool.exe" -exportcert -alias forumurology -keystore uroweb7228.keystore | openssl sha1 -binary | openssl base64
Enter keystore password:  *******
c/6e5fY8Rg3Gshn1TKucia***/A=

C:\openssl\bin>"C:\Program Files\Java\jre7\bin\keytool.exe" -exportcert -alias a
ndroiddebugkey -keystore debug.keystore | openssl sha1 -binary | openssl base64
Enter keystore password:  android
3L0oeMh7uk9YWE0sYavUuT***yU=

然后将其保存到我的 facebook 应用程序设置中。当我运行 release .apk 时,我有错误:

10-21 16:48:11.583: W/fb4a(:<default>):BlueServiceQueue(20097): Exception during service
10-21 16:48:11.583: W/fb4a(:<default>):BlueServiceQueue(20097): com.facebook.http.protocol.ApiException: Key hash ypC1--aybTSQXdzXGLtM-_nXydI does not match any stored key hashes.
10-21 16:48:11.583: W/fb4a(:<default>):BlueServiceQueue(20097):     at com.facebook.http.protocol.ApiResponseChecker.b(ApiResponseChecker.java:83)
4

1 回答 1

3

这是因为设备正在创建一个不在您的应用设置中的新密钥哈希。所以你必须相应地更新keyhash..在onCreate()中使用它

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.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
                }
        } catch (NameNotFoundException e) {

        } catch (NoSuchAlgorithmException e) {

        }
于 2013-10-21T13:14:34.673 回答