问题
How do you add an plugin not using the <vs:feature />
sections. I need to add some plugins that when you add them they ask for variables. If i use cordova plugin add, how do I then reference the plugin in the application?
This is driving me crazy, seems a proper over site and makes the whole thing unusable.
I keep getting the error:
Error 17 Variable(s) missing: APP_ID, APP_NAME F:\Development\sdfsdfsd\sdfdsfi\EXEC 1 1 sdfsdfsd
Error 18 The command ""C:\Users\Tom.AD\AppData\Roaming\npm\node_modules\vs-mda\vs-cli" prepare --platform Android --configuration Release --projectDir . --projectName "sdffds" --language "en-US"" exited with code 8. C:\Users\Tom.AD\AppData\Roaming\npm\node_modules\vs-mda-targets\Microsoft.MDA.targets 182 5 sdfdsff
I've tried adding the following in the config.xml
<preference name="APP_ID" value="ssssss" />
<preference name="APP_NAME" value="ssssss" />
And
<vs:feature>
https://github.com/Wizcorp/phonegap-facebook-plugin.git
<preference name="APP_ID" value="sssss" />
<preference name="APP_NAME" value="ssss" />
</vs:feature>
And
<vs:feature>
https://github.com/Wizcorp/phonegap-facebook-plugin.git
<params name="APP_ID" value="ssssss" />
<params name="APP_NAME" value="sssss" />
</vs:feature
回答1:
The documentation for this plugin covers this here: https://github.com/Wizcorp/phonegap-facebook-plugin/blob/master/platforms/android/README.md
Here is their example:
cordova -d plugin add /Users/your/path/here/phonegap-facebook-plugin --variable APP_ID="123456789" --variable APP_NAME="myApplication"
回答2:
MSDN suggest to manually install it and enter the variables yourself
- download as zip from github
- extract to your /plugiuns folder (create if it doesnt exist)
in your unpacked plugin edit plugin.xml:
delete
<preference name="APP_ID"> and <preference name="APP_NAME">
add
<params name="APP_ID" value="ssssss" />
<params name="APP_NAME" value="sssss" />
回答3:
For VS2015RC try like this
<vs:plugin name="cc.fovea.cordova.purchase" source="npm" version="3.11.0">
<param name="BILLING_KEY" value="CONSTRUCT_YOUR"/>
</vs:plugin>
OR
<vs:plugin name="cc.fovea.cordova.purchase" version="3.11.0" />
modify plugins\fetch.json like this
{
"cc.fovea.cordova.purchase": {
"source": {
"type": "git",
"url": "https://github.com/j3k0/cordova-plugin-purchase.git",
"subdir": "."
},
"variables": {
"BILLING_KEY": "CONSTRUCT_YOUR"
}
}
来源:https://stackoverflow.com/questions/25553724/add-a-plugin-with-variables