PhoneGap的构建 - 连接Facebook插件 - 无效android_key参数错误 [英] Phonegap build - Facebook connect plugin - Invalid android_key parameter error
问题描述
我通过PhoneGap的构建运行例如code(下中)产生一个Android APK。
I'm running example code (found below) through phonegap build to produce an android apk.
的https://github.com/phonegap-build/FacebookConnect/blob/master/example/Simple/index.html
当我试图通过Android设备上的应用程序(安装了Facebook应用程序)登录到Facebook上,我得到这个错误:
When I try to log into facebook through the app on an android device (with the facebook app installed), I get this error:
无效android_key参数J4INwYsuTyQ_LJc1d3WZ2HReg7M不符合任何允许Android的关键。在 http://developers.facebook.com/apps/ 应用程序ID配置您的应用程序键哈希
Invalid android_key parameter J4INwYsuTyQ_LJc1d3WZ2HReg7M does not match any allowed android key. Configure your app key hashes at http://developers.facebook.com/apps/'app id'
我有复制粘贴此键进入我的应用程序的Android设置的关键散列部分,但是当我尝试登录使用的应用程序仍然抛出了同样的错误。
I have copy-pasted this key into the key hashes section of my app's android settings but it still throws the same error when I try to log in using the app.
如何我能得到这个程序登录到Facebook的成功?
How can I get this app to log into facebook successfully?
OR:什么是另一种方式,使Android应用使用PhoneGap的登录到Facebook的
OR: What is another way to enable an android app to log into facebook using phonegap?
这里有一些事情我已经做了:
Here are some things I have done:
-
在我的Facebook应用程序的设置:
- 设置包名在我PhoneGap的config.xml中发现了小部件ID。
- 设置'类名'的包名.ProjectActivity附加到它。
- 已启用'上的单点登录和残疾人深层链接。
- 所做的应用程序向公众开放(通过'状态和放大器;审查。栏目
- 进入APP_ID在我的Facebook应用程序仪表板中找到的ID
- 进入APP_NAME作为命名空间在我的Facebook应用程序的设置中发现
- 做了一个密钥库(使用这样的回答: http://stackoverflow.com/a/19315975/1696114 )和用它来生成一个版本的apk。
- Made a keystore (using this answer: http://stackoverflow.com/a/19315975/1696114) and used it to generate a release apk.
推荐答案
我成功地可以通过使用PhoneGap的,Facebook的插件,并在当地建设我科尔多瓦/ PhoneGap的项目登录到Facebook上的应用程序。
I successfully made an app which can log into facebook by using the phonegap-facebook-plugin and by building my cordova/phonegap project locally.
我做了一个新的项目科尔多瓦并添加了Android平台的这个项目,这里的操作说明:的 http://docs.phonegap.com/en/3.4.0/guide_overview_index.md.html#Overview
I made a new cordova project and added the android platform for this project, following the instructions here: http://docs.phonegap.com/en/3.4.0/guide_overview_index.md.html#Overview
在做这个,我发现我犯了使用的是旧版本的科尔多瓦(3.1)我的previous项目未故意,我没有装科尔多瓦命令行界面。也许有其他问题,我做了我的第一个项目的方式。
In doing this I discovered I had made my previous project using an older cordova version (3.1) un-intentionally and that I hadn't installed the cordova command line interface. There may have been other issues with the way I made my first project.
然后我加入这里找到了PhoneGap的,Facebook的插件: https://github.com/ PhoneGap的/ PhoneGap的,Facebook的插件使用此命令(从我的项目的位置):
I then added the phonegap-facebook-plugin found here: https://github.com/phonegap/phonegap-facebook-plugin using this command (from my project location):
cordova plugin add https://github.com/phonegap/phonegap-facebook-plugin.git --variable APP_ID="xxxxxxxxxxxxx" --variable APP_NAME="xxxxxxxx"
(我的Facebook应用程序ID,并与我的应用程序的命名空间APP_NAME值替换APP_ID值)。
(replacing APP_ID value with my facebook app id and APP_NAME value with my app's namespace).
我再换成我的index.html与在PhoneGap的,Facebook的插件GitHub的页面+ /blob/master/example/Simple/index.html(替换用我的应用程序ID的APP_ID值)发现的例子索引文件。
I then replaced my index.html with the example index file found at the phonegap-facebook-plugin github page + /blob/master/example/Simple/index.html (replacing the app_id value with my app id).
然后我跑了使用该应用程序直接到自己的Android设备:
I then ran the app straight to my android device using:
cordova run android
在这个程序,我能够使用的实例提供的接口来登录,后到我自己或朋友的墙壁等。使用这个新的项目(已更新科尔多瓦版)我可能能够使用的PhoneGap构建但我还没有尝试过呢。
In this app, I'm able to use the interface provided by the example to login, post to my own or friends' walls etc. Using this new project (with updated cordova version) I may be able to use phonegap build but I haven't tried yet.
感谢拿督穆罕默德Nurdin为使用这个插件的建议。
Thanks to Dato' Mohammad Nurdin for the suggestion to use this plugin.
这篇关于PhoneGap的构建 - 连接Facebook插件 - 无效android_key参数错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!