问题描述
最近,我通过遵循facebook开发人员页面上有关如何导出并获取我们需要放入开发人员门户中的哈希键的指示,使我的Facebook在调试应用程序时能够正常工作.
I have recently got Facebook to work when debugging my application by following the insructions on facebooks developer page on how to export and get the hash key we need to put in the developer portal.
现在完成了,我尝试使用带我的应用程序的导出和签名版本的facebook登录.不幸的是我无法使其正常工作.通过facebook应用程序或网页登录后,它将永远不会返回登录会话.
So now this is done, i tried using facebook log in with a exported and signed version of my application. Unfortunately i was not able to get it to work. It would never return a log in session after logging in through the facebook app or web page.
我相信这是由于密钥是已发布的和已签名的apk与我用于调试的apk之间的差异所致.
I believe this is due to the keys being difference between the released and signed apk and the apk i use to debug.
有人知道如何解决此问题吗?
Anyone know how to fix this problem?
推荐答案
您正确地认为密钥哈希与debug.keystore和发行签名密钥不同.为此,请按照以下网站上的步骤操作: http://www. helloandroid.com/tutorials/using-facebook-sdk-android-development-part-1
You are correct on the key hash's being different from the debug.keystore and the release signing key. To remedy that, follow the steps on this website here: http://www.helloandroid.com/tutorials/using-facebook-sdk-android-development-part-1
它有一个不错的教程,几乎可以立即解决该问题.
It has a nice tutorial that will fix the issue in almost no time.
其要旨是:
- 下载适用于Windows的OpenSSl ,然后将.zip解压缩到一个简单的位置,例如: c:\ openssl,所有zip内容都提取到该文件夹的根目录中.
- 将您的签名密钥文件复制到JRE安装的bin文件夹中.例如,在我的情况下:
C:\Program Files\Java\jre7\bin
- 在复制签名密钥的bin文件夹中,按 +右键单击->在此处打开命令窗口.
- 运行此命令:keytool -exportcert -alias YOUR_ALIAS -keystore YOUR_SIGNING_KEY> c:\ openssl \ bin \ debug.txt
- 输入签名密钥的密码
- 现在,导航至c:\ openssl \ bin文件夹并键入以下命令:
- Download OpenSSl for Windows and extract the .zip to a simple location like: c:\openssl with all the contents of the zip extracted in this folder's root.
- Copy your signing key file to your JRE installation's bin folder. For example, in my case:
C:\Program Files\Java\jre7\bin
- While in the bin folder where you copied the signing key, Press + Right Click -> Open command window here.
- Run this command: keytool -exportcert -alias YOUR_ALIAS -keystore YOUR_SIGNING_KEY > c:\openssl\bin\debug.txt
- Enter your password for the signing key
- Now, navigate to the c:\openssl\bin folder and type in the following commands:
openssl sha1 -binary debug.txt > debug_sha.txt
然后
openssl base64 -in debug_sha.txt > debug_base64.txt
完成! debug_base64.txt 包含您的密钥哈希.将其复制到您的应用程序控制台中,一切就绪.
Done! The debug_base64.txt contains your Key Hash. Copy this in your app console and you are all set.
这听起来很长,但实际上您将在4-5分钟内完成操作. ;-)
This sounds lengthy, but you really will be done in literally 4 - 5 minutes. ;-)
这篇关于Facebook无法使用导出/签名的APK文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!