Android Facebook SDK: Key hash does not match

来源:互联网 发布:攻城掠地数据库 编辑:程序博客网 时间:2024/05/17 20:54

开发一个Android App,其中使用了Facebook SDK,需要向Facebook提交该App的key hash。

按照Facebook官方步骤,使用以下命令即可生成key hash:

keytool -exportcert -alias <RELEASE_KEY_ALIAS> -keystore <RELEASE_KEY_PATH> | openssl sha1 -binary | openssl base64
然而,App一直未能正确运行,很简单的一个App,各种因素干扰,找了很久原因,终于确认是key hash不匹配的问题,然而,为什么呢,一切操作皆遵守官方,已经试了几百遍了!


Fuck openssl! A big waste of time!

问题便出在openssl上,openssl较新的版本09.8k存在bug,其计算得出的key hash可能是错误的,我们回滚到0.9.8e版本,问题得以解决。so,用开源的东西有时候是有代价的。


以下是国外的受害者:

@fernandomatos

fernandomatos commented on 12 Nov 2011

Hi guys,

Windows users have to be careful about openssl-for-windows (http://code.google.com/p/openssl-for-windows/downloads/list), the latest version, at least on plataform 64bits, don't generate the correct hash that Facebook need it for android apps.

When we are using this plugin we need provide a security hash to the facebook, in our aplication page (https://developers.facebook.com/apps), if what i'm saying don't make sense for you I recomend you read these materials:
http://developers.facebook.com/docs/mobile/android/build/#sig
http://developer.android.com/guide/publishing/app-signing.html

If you've read these materials and already know how works and how you will have to do to generate your security hash to use this plugin, remember of this tip:

Use one of this versions: openssl-0.9.8e_X64.zip or openssl-0.9.8d_X64.rar

You should not use the openssl-0.9.8k_X64.zip.

I hope this tip be useful. I lost a lot of time, testing ways to generate the correct hash and in the end the problem was with the latest version of openssl.


buhlly88 commented on 26 Nov 2011

fernandomatos,
Just wanted to say thank you. I spend 2 days banging my head against the wall until I finally came across this post. Once I used the older version of openssl to generate the security hash it worked.

Thanks for posting.


kotibabu commented on 23 Jul 2012

thank you from past 3 days i spent time with this through you post my issue is solved


chaunvbka commented 25 days ago

thanks you very much. I also lost a lot of time with this problem.



0 0