I wrote a guide how to setup the Facebook Plugin without eclipse. It is already part of the installation guidelines on the repository. Check it out at: https://github.com/Wizcorp/phonegap-facebook-plugin/blob/master/platforms/android/README.md
Cordova 3.4 Facebook connect, add Library
-
29-06-2023 - |
Question
I updated to Cordova 3.4 and want to use the newest version of the facebook connect (https://github.com/phonegap/phonegap-facebook-plugin) plugin. I followed the steps there.
But I do not use eclipse to develop. So I need to add the Facebook library by command line.
I followed the steps of Abdullah in this post.
My folder structure:
+ platforms
+ android
...
+ plugins
+ ...
+ facebook-android-sdk-3.8.0
+ facebook
...
I ran in platforms/android/
this command:
android update project --target 3 --path . --library ../../facebook-android-sdk-3.8.0/facebook/
But now I'm stuck with the following error:
facebook-android-sdk-3.8.0/facebook/build.xml:46: sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var
during the build with cordova build android
do you have an idea how I could fix this?
My platforms/android/project.properties
looks like this:
...
# Project target.
target=android-18
android.library.reference.1=CordovaLib
android.library.reference.2=../../facebook-android-sdk-3.8.0/facebook/
My platforms/android/local.properties
looks like this:
...
# header note.
sdk.dir=/Users/<username>/Development/adt-bundle-mac-x86_64/sdk
which is correct as well.
The complete output of cordova build android
:
cordova build android
[ReferenceError: a is not defined]
Running command: /Users/<username>/App_Entwicklung/20/<application>/platforms/android/cordova/build args=[]
Buildfile:/Users/<username>/App_Entwicklung/20/<application>/platforms/android/build.xml
-set-mode-check:
-set-debug-files:
-check-env:
[checkenv] Android SDK Tools Revision 22.6.2
[checkenv] Installed at /Users/<username>/Development/adt-bundle-mac-x86_64/sdk
-setup:
[echo] Project Name: <application>20
[gettype] Project Type: Application
-set-debug-mode:
-debug-obfuscation-check:
-pre-build:
-build-setup:
[getbuildtools] Using latest Build Tools: 19.0.3
[echo] Resolving Build Target for <application>20...
[gettarget] Project Target: Android 4.3
[gettarget] API level: 18
[echo] ----------
[echo] Creating output directories if needed...
[echo] ----------
[echo] Resolving Dependencies for <application>20...
[dependency] Library dependencies:
[dependency]
[dependency] ------------------
[dependency] Ordered libraries:
[dependency]
[dependency] ------------------
[echo] ----------
[echo] Building Libraries with 'debug'...
BUILD FAILED
/Users/<username>/Development/adt-bundle-mac-x86_64/sdk/tools/ant/build.xml:601: The following error occurred while executing this line:
/Users/<username>/App_Entwicklung/20/<application>/facebook-android-sdk-3.8.0/facebook/build.xml:46: sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var
Total time: 0 seconds
Error code 1 for command: ant with args: debug,-f,/Users/<username>/App_Entwicklung/20/<application>/platforms/android/build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
Error: /Users/<username>/App_Entwicklung/20/<application>/platforms/android/cordova/build: Command failed with exit code 2
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/src/superspawn.js:112:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5)
Solution 2
OTHER TIPS
The problem is not in your actual project but in the android Facebook SDK and occurs because the FacebookSDK android project isn't able to locate the Android SDK.
To fix it:
Navigate to your FacebookSDK folder (for me this is facebook-android-sdk-3.8.0/facebook) and look for the project.properties file.
Edit this file and specify the path to the sdk (like you did for your core project). sdk.dir=/Users//Development/adt-bundle-mac-x86_64/sdk
Save and rebuild.
Navigate to your facebook-sdk-3.8.0/facebook folder and run the following command
android update project -p .
(keep the dot at the end)