How do I install the facebookconnect cordova plugin?

I am trying to use a plugin com.phonegap.plugins.facebookconnect

. To set it, I have to provide two variables, for example:

cordova plugin add com.phonegap.plugins.facebookconnect --variable APP_ID="<app_id>" --variable APP_NAME="<app_name>"

      

This works, but then the build fails due to this issue .

BUILD FAILED
/Applications/Android Studio.app/sdk/tools/ant/build.xml:720: The following error occurred while executing this line:
/Applications/Android Studio.app/sdk/tools/ant/build.xml:734: Compile failed; see the compiler error output for details.

Total time: 6 seconds

.../platforms/android/cordova/node_modules/q/q.js:126
                    throw e;
                          ^
Error code 1 for command: ant with args: debug,-f,.../platforms/android/build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
Error: .../platforms/android/cordova/run: Command failed with exit code 8
    at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:755:16)
    at Process.ChildProcess._handle.onexit (child_process.js:822:5)

      

The traditional way to solve the above problem is to remove all platforms and add them again. The problem is that when platforms are added, they try to install the plugin for themselves, but they don't pass the variables that the plugin should set correctly, resulting in:

Failed to install 'com.phonegap.plugins.facebookconnect':Error: Variable(s) missing: APP_ID, APP_NAME
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:301:23
    at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:798:54)
    at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:827:30)
    at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:760:13)
    at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:574:44
    at flush (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:108:17)
    at process._tickCallback (node.js:419:13)
Error: Variable(s) missing: APP_ID, APP_NAME
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:301:23
    at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:798:54)
    at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:827:30)
    at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:760:13)
    at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:574:44
    at flush (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:108:17)
    at process._tickCallback (node.js:419:13)

      

So, I get either a properly installed plugin, or a bad build, or an incorrectly installed plugin, or a simple build.

This makes it impossible to use the facebookconnect plugin, because of course the plugin must be installed correctly AND the build must go through.

Any quick solution for this?

more details

$ cordova -v
3.5.0-0.2.7

      

related issues

+1


source to share


4 answers


To avoid the problem with the cordora, do not try to build with the cordora. Just use cordova to create your project, add frameworks, and add plugins (in that order). Then use xcode or android studio or visual studio to build and run. This solved the problem for me.

Also, don't add the plugin to the registry. Download the zip file, unzip it and then add it locally. Thanks to @tapmonkey for the following link that explains it:



fooobar.com/questions/1547554 / ...

0


source


Never include android facebook library in your cordova project. Use these libraries instead.

https://github.com/phonegap-build/FacebookConnect/tree/master/src/android/facebook



Link: http://blog.revivalx.com/2014/05/20/integration-cordova-facebook-connect-plugin-for-android/

+1


source


You can use the facebook plugin from the cordova plugin registry. Here is the link ( http://plugins.cordova.io/#/package/com.ccsoft.plugin.cordovafacebook) It supports cordova version above 3, android facebbok SDK is also required. You can download from ( https://developers.facebook.com/docs/android ) here.

0


source


Just run the same command with because it requires root access. sudo

sudo cordova plugin add com.phonegap.plugins.facebookconnect --variable APP_ID="<app_id>" --variable APP_NAME="<app_name>"

      

enter password

if he asks and you agree well.

0


source







All Articles