Search code examples
androidcordovacordova-cli

Cordova CLI overwriting Plugman plugin on Android?


I'm writing a Plugman-compatible Cordova plugin. Installing it via Plugman, I've confirmed it installs correctly and runs normally:

plugman --platform android --project /platforms/android --plugin my/plugin.path

But if I use:

cordova build/cordova run android

it doesn't work even with plugin installed. This is because Plugman only installs my plugin js file to the /platforms/android/assets/www folder and not the base /www folder, so when I build, the /www folder without the plugin gets copied to /platforms/android/assets/www.

Is there an option or something in plugin.xml I should be specifying to install the plugin to the project root www folder?


Solution

  • When using Cordova CLI, you shouldn't install plugins using plugman. Cordova CLI does use plugman under the covers, but what you want to use is cordova plugins add http://... or cordova plugins add /path/to/plugin.xml.

    You didn't specify which version of Cordova you are using, but here's some examples of adding plugins that are core functionality: http://cordova.apache.org/docs/en/3.0.0/guide_cli_index.md.html#The%20Command-line%20Interface