PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, June 29, 2022

[FIXED] How can I install the facebookconnect cordova plugin?

 June 29, 2022     cordova, cordova-plugins, facebook, facebook-sdk-4.0     No comments   

Issue

I am trying to use the com.phonegap.plugins.facebookconnect plugin. To install it, I must provide two variables, like this:

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

This works, but then the build fails because of 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 aforementioned issue is to remove all platforms and add them again. The problem is that when the platforms are added, they try to install the plugin for themselves, but don't pass in the variables the plugin needs to correctly install, 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 correctly installed plugin, but a failing build, or an incorrectly installed plugin and a passing build.

This makes it impossible to use the facebookconnect plugin, because, of course, the plugin needs to be installed correctly AND the build needs to pass.

Any quick solution for this?

more info

$ cordova -v
3.5.0-0.2.7

related questions

  • Apache Cordova Facebook Plugin BUILD FAILED
  • https://stackoverflow.com/questions/24175167/cordova-facebookconnect-compiling-error?rq=1

Solution

To avoid the cordova issue, don't try building with cordova. Just use cordova to create the project, add platforms, and add plugins (in that order). Then, use xcode or android studio or visual studio to build and run. This is what solved the problem for me.

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

https://stackoverflow.com/a/25327341/585580



Answered By - Shawn
Answer Checked By - Mary Flores (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing