Facebook SSO示例不工作 - “出现错误。请稍后重试“ [英] Facebook SSO example not working - "An error ocurred. Please try again later"
问题描述
我正在尝试将facebook整合到我的应用程序中,因此遵循了本教程: Facebook Android ,但我无法获得第一个例子(单点登录)工作。当我的应用加载时,我会收到Facebook对话框,但它只是说发生错误,请稍后再试。在底部有一个Facebook风格的Ok按钮,在logcat中没有任何内容:
I'm trying to integrate facebook into my app and so have followed the tutorial at: Facebook Android but I can't get the first example (Single Sign-On) to work. When my app loads up I get the facebook dialog but it just says "An error occurred. Please try again later." with a facebook-style "Ok" button at the bottom and there is nothing in logcat:
我按照教程中的步骤进行操作,但是我猜测这个API ID或者keytool生成的hashkey有问题。以下是我遵循的步骤:
I followed the steps in the tutorial but I'm guessing there is something wrong with the APP ID or the hashkey generated by keytool. Here are the steps I followed:
- 克隆fb git。
- 创建fbSDK项目。 li>
- 创建自己的fb项目并将fbSDK作为库链接。
- 然后我用openssl输入了keytool cmd,并输入了密码android,如
- 我去了developers.facebook.com并创建了一个新的应用程序。
- 在编辑设置 - >手机和设备我把哈希放在提供的框中。
- 在编辑设置 - >手机和设备中,我选择了本机应用程序作为应用程序类型
- 回到应用程序我复制并粘贴SSO示例代码。
- 我将Facebook()构造函数中的YOUR_APP_ID更改为developers.facebokk.com上显示的APP ID我的新应用程序页面
- 我在手机上运行了应用程序。
- clone fb git.
- create fbSDK project.
- create own fb project and link the fbSDK as a library.
- I then did the keytool cmd with openssl and input the password "android" as suggested by others on stackoverflow.
- I went to developers.facebook.com and created a new app.
- In "Edit Settings->Mobile and Devices" I put my hash in the box provided.
- In "Edit Settings->Mobile and Devices" I chose "Native App" as "Application Type"
- Back in the app I copy and pasted the SSO example code.
- I changed the "YOUR_APP_ID" in the Facebook() constructor to the APP ID shown on the developers.facebokk.com page for my new app.
- I ran the app on my phone.
不知道为什么在logcat中没有什么,但是当我安装它时,控制台总是在没有失败的情况下说: ActivityManager:Warning:Activity没有启动,它的当前任务已经被带到前端
I don't know why there is nothing in logcat but when I install it, the Console always, without fail, says the:ActivityManager: Warning: Activity not started, its current task has been brought to the front
我找不到任何logcat引用到我的应用程序或错误我从Facebook sdk得到的是: Facebook-ProxyAuth(4828):无法读取呼叫包的签名。
And I can't find any logcat reference to my app or the error I was getting from the facebook sdk which was: Facebook-ProxyAuth(4828): Failed to read calling package's signature.
我已经在这几个小时了,任何帮助将不胜感激。我不敢相信Facebook的SDK和帮助是如此粗略的Android,Facebook应该为自己感到羞耻。
I have been at this for a few hours now and any help would be greatly appreciated. I can't believe the facebook SDK and help is so sketchy for Android, facebook should be ashamed of themselves.
谢谢,
InfinitiFizz
InfinitiFizz
推荐答案
其实我遇到了同样的问题,它解决了。
因此,在哈希密钥生成中使用以下步骤:
In fact I have encountered the same problem exactly and it solved. So, in the hash key generation use the following steps:
- 打开cmd并转到您的Android SDK路径。 li>
- 键入以下命令:
keytool -exportcert -alias androiddebugkey -keystore [您的SDK路径|例如c:\users\user] .android\debug.keystore | openssl sha1 -binary | openssl base64 - 之后,密码输入android
- 将结果复制到您的Facebook应用设置并保存设置。
- 在您的Android应用程序中使用Facebook应用程序ID(而不是Android哈希键)。
- open cmd and go to your android SDK path.
- type this command : keytool -exportcert -alias androiddebugkey -keystore [your SDK path | e.g c:\users\user].android\debug.keystore | openssl sha1 -binary | openssl base64
- after that it's promet for password enter "android"
- copy the result to your facebook app settings and save settings.
- in your android app use the facebook app id(not the android hash key).
这篇关于Facebook SSO示例不工作 - “出现错误。请稍后重试“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!