2
votes

I have a cordova 3.5 project with a config.xml which I added a plugin.

The file is located in the project root-directory.

The config.xml looks like this:

<?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.hellocordova" version="0.0.1"     xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>Client</name>
    <description>
    descr
</description>
<author email="mail" href="href">
    author
</author>
<content src="index.html" />
<access origin="*" />
<plugins>
    <plugin name="Device" value="org.apache.cordova.device"/>
</plugins>

I'd like the plugin to be installed when I build the platform by cli:

cordova platform build android/ios ...

But the file is not applied to the project. Using cli to add a plugin works. But this is uncomfortable using version control.

What's wrong with the config.xml?

2

2 Answers

1
votes

Now cordova maintains two config files. one at root directory and one specific to platform. When you run build command it mergers both the files. Plugin tag of platform specific have higher priority. you should install plugin from cli although incase you want it manually you can add plugin details in platform.json file within plugin folder. But this is not recommended.

0
votes

If you are building locally via the cli you need to add plugins:

$ cordova plugin add org.apache.cordova.device

http://cordova.apache.org/docs/en/3.5.0/guide_cli_index.md.html.

This will automatically add it to the config.xml.