Android的Facebook的SDK

Android的Facebook的SDK

本文介绍了Android的Facebook的SDK:产生释放密钥散列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要建一个应用程序中,用户可以与Facebook登录。

I'm building an app in which users can log in with Facebook.

我已经创建了哈希键类似如下:

I've created the hash keys like following:

try {
         PackageInfo info = getPackageManager().getPackageInfo(
         "com.app.package",
         PackageManager.GET_SIGNATURES);
         for (Signature signature : info.signatures) {
         MessageDigest md = MessageDigest.getInstance("SHA");
         md.update(signature.toByteArray());
         Log.d("KeyHash", "KeyHash:"+ Base64.encodeToString(md.digest(),
         Base64.DEFAULT));
         Toast.makeText(getApplicationContext(), Base64.encodeToString(md.digest(),
                 Base64.DEFAULT), Toast.LENGTH_LONG).show();
         }
         } catch (NameNotFoundException e) {

         } catch (NoSuchAlgorithmException e) {

         }

在调试模式下,一切正常。

In debug mode, everything works well.

在我出口项目发布,它给这个错误:

When i export the project for release, it gives this error:

"Invalid key hash. The key hash ****************** does not match any stored key ashes etcc"

我贴印在Facebook的开发人员仪表板的关键,但应用程序仍然给我的错误。

I paste the key printed in the Facebook Developer dashboard, but the application still gives me that error.

完整的包我actvity的是 com.app.package.views 我试图用这个包(如谷歌播放包名称)在仪表板,但什么都没有改变。

The complete package of my actvity is "com.app.package.views" and i tried to use this package (as Google Play Package Name) in the dashboard, but nothing changed.

我该如何解决呢?我怎样才能产生正确的释放钥匙哈希?

How can I solve it? How can I generate the right release key hash?

推荐答案

您其次是Facebook提供用于创建一个登录应用程序呢?步骤

You followed the steps that facebook provides for the creation of a login application?

您需要一个生产keyhash获得的开始你的发行版的密钥库:

You need a 'Production keyhash' obtained starting your release keystore:

从驾驶室管理线:

keytool -exportcert -alias <RELEASE_KEY_ALIAS> -keystore <RELEASE_KEY_PATH> | openssl sha1 -binary | openssl base64

和添加此键上的Facebook应用程序页面的选项。

And add this key on facebook app page options.

More information: https://developers.facebook.com/docs/android/getting-started/

这篇关于Android的Facebook的SDK:产生释放密钥散列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 16:50