我在生成 key 哈希时遇到问题。 我做了 2 把 key :
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)
最佳答案
这是因为设备正在创建一个不在您的应用设置中的新 key 哈希。所以你必须相应地更新 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) {
}
关于android - Facebook 发布 key_hash,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19495336/