[英]Import facebook SDK to cordova/phonegap project
I'm creating my first app using cordova 3.3.0 (aka phonegap). 我正在使用cordova 3.3.0(又名phonegap)创建我的第一个应用程序。 Everything's all right : I can run project on to Android Device Emulator and on to my mobile. 一切都很好:我可以将项目运行到Android设备模拟器和我的手机上。
I'd like to use the facebook connect plugin : https://github.com/phonegap/phonegap-facebook-plugin 我想使用facebook连接插件: https : //github.com/phonegap/phonegap-facebook-plugin
But all the documentation I read (particularly : https://developers.facebook.com/docs/android/getting-started ) explains how to set up the Facebook SDK through Eclipse. 但我读过的所有文档(特别是: https : //developers.facebook.com/docs/android/getting-started )都解释了如何通过Eclipse设置Facebook SDK。 I've also found doc on how to install in Androïd Studio. 我还找到了有关如何在AndroïdStudio中安装的文档。
I don't want to install neither of them, I do all in command line since I like to know how things works (at least for my first projetc ...). 我不想安装它们,我在命令行中完成所有操作,因为我想知道事情是如何工作的(至少对于我的第一个项目来说......)。
So the question is : how do I import facebook SDK into my cordova project ? 所以问题是:如何将facebook SDK导入我的cordova项目?
Thanks for your ideas ! 谢谢你的想法!
Alright I found the answer, was struggling with the exact same problem. 好吧,我找到了答案,正在努力解决同样的问题。 I was actually trying to get an ionic cordova project to use the facebook plugin 我实际上试图让一个离子cordova项目使用facebook插件
You have to go inside the Platform/android folder of your cordova project. 你必须进入你的cordova项目的Platform / android文件夹。 At this point , you are just dealing with a regular android project 此时,您只是在处理常规的android项目
run the following command 运行以下命令
android update project --target 3 --path C:\\Users\\<yourname>\\Documents\\Projects\\<projectName>\\ionic\\platforms\\android --library ../../../../facebook-android-sdk-3.7/facebook
Alright a couple of tricks 好吧,几个技巧
go to project. 去项目。 properties and you should see something like the following 属性,您应该看到类似以下内容
android.library.reference.1=CordovaLib android.library.reference.1 = CordovaLib
android.library.reference.2=../../../../facebook-android-sdk-3.7/facebook target=android-18' android.library.reference.2 = .. / .. / .. / .. / facebook-android-sdk-3.7 / facebook target = android-18'
Hope this helps someone, I'm not too fond of using eclipse for phonegap either. 希望这有助于某些人,我也不太喜欢使用eclipse进行手机游戏。
Faced also the same problem today with cordova 3.3. 今天面对的还有与cordova 3.3相同的问题。 Solution is similar to the other one given, maybe can be helpful. 解决方案与给出的其他解决方案类似,可能会有所帮助。 I am on linux environemnt 我在linux environemnt上
I managed to build by: 我设法建立:
installing the plugin 安装插件
cordova plugin add https://github.com/phonegap/phonegap-facebook-plugin.git --variable APP_ID="yourvalues" --variable APP_NAME="yourvalues"
cd /platforms/android
add this line to project.properties 将此行添加到project.properties
android.library.reference.2=FacebookLib
update the project 更新项目
android update project --subprojects --path . --target "android-19"
Then compiled successfully with 然后成功编译
cordova build
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.