Cordova, Facebook, Android and no Eclipse
Written in 2014. Versions, commands and links may well be out of date.
This post relates to creating an Android application with Facebook support (via phonegap-facebook-plugin using Cordova 3.5 and, specifically, without Eclipse. Most existing documentation expects you to spin up Eclipse to link the Facebook libraries - but, we’re using an automated build system with Grunt so that’s not a possibility. Firstly - the steps to get it working:
-
Add the Cordova Facebook plugin:
cordova plugin add https://github.com/phonegap/phonegap-facebook-plugin \ --variable APP_ID="1234567890" --variable APP_NAME="Test App" -
Edit
platforms/android/project.propertiesand add:android.library.reference.2=FacebookLibwhere n is the next available reference index. Also note the
targetparameter here as you’ll need it next: -
Update the Android project for the plugin:
cd platforms/andoird/FacebookLib android update project --target android-19 -p .where
android-19should match thetargetparameter from above. -
Prepare and build your application:
cordova prepare android cordova compile android