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.properties
and add:android.library.reference.2=FacebookLib
where n is the next available reference index. Also note the
target
parameter 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-19
should match thetarget
parameter from above. - Prepare and build your application:
cordova prepare android cordova compile android