Wizcorp/phonegap-facebook-plugin

Missing APP_ID APP_NAME on cordova platform add

Opened this issue · 7 comments

Lestt commented

Hi all,

I try to add my platform with cordova, but this plugin needs 2 paremeter: APP_ID and APP_NAME.
First, if i had the plugin manually with "cordova add plugin ...." there is no pb.
My issue is this plugin is referenced in package.json and config.xml, with parameter setted, but when i try to use cordova platform add to add it i got this error.
I tried a lot of syntax in both of the two files, actually i have that:
package.json

"cordovaPlugins": [
    "cordova-plugin-compat",
    "cordova-plugin-crosswalk-webview",
    {
       "locator": "com.phonegap.plugins.facebookconnect",
       "variables": {
           "APP_ID": "123456",
           "APP_NAME": "MyAppName"
       }
    }
]

config.xml

<plugin name="com.phonegap.plugins.facebookconnect">
    <variable name="APP_ID" value="123456"/>
    <variable name="APP_NAME" value="MyAppName"/>
</plugin>

Did i do a mistake somewhere ? Is that possible to do that ?

Thanks for the help !

Ruff9 commented

same here, the params seems corrects, but when my CI tries to Installing "cordova-plugin-facebook4" for ios, it fails with the following error:

Failed to install 'cordova-plugin-facebook4':Error: Variable(s) missing: APP_ID, APP_NAME

Lestt commented

@Ruff9 check in your package.json file, in the cordovaPlugins section, i you don't have two reference to the cordova-plugin-facebook4: one with a node containing the parameter, a second without (it's just a line). If you have, delete the second, rm the platform and try to add it again.

Ruff9 commented

@Lestt we don't have any cordovaPlugins section in our package.json, we use the config.xml to store data about our plugins... it works well, except for this plugin.

Lestt commented

@Ruff9 Well, i'am using ionic, the cordovaPlugins' section in package.json file should belong to it... I didn't find any other solution for this problem. Btw i changed to this plugin to do login and share on facebook in my app (he seems to be more maintained than phonegap-facebook-plugin)
Try it maybe it will solve your problem

Ruff9 commented

@Lestt I will look into this other plugin, thanks :)

I found a workaround. You can check-it here:

https://forum.ionicframework.com/t/impossibile-to-add-android-platform-with-cordova-plugin-ionic/109162/5

It seems to me that the script to add platforms doesn't handle well those who have additional parameters in package.json or config.xml.

You will see the parameter's JSON object in configuration files but "cordova platform add" breaks when dealing with plug-in that need additional parameters.

Hope it helps!