If you added add_plugin and removed the plugins, your .json package should have a list of cordovaPlugins.
If so, then the solution I used is to remove the platform and add it again for extraction for all plugins
cordova platform remove android cordova platform add android
here are the necessary hooks
<strong> hooks / after _plugin_add / 010_register_plugin.js
#!/usr/bin/env node /** * Push plugins to cordovaPlugins array after_plugin_add */ var fs = require('fs'); var packageJSON = require('../../package.json'); packageJSON.cordovaPlugins = packageJSON.cordovaPlugins || []; process.env.CORDOVA_PLUGINS.split(',').forEach(function (plugin) { if(packageJSON.cordovaPlugins.indexOf(plugin) == -1) { packageJSON.cordovaPlugins.push(plugin); } }); fs.writeFileSync('package.json', JSON.stringify(packageJSON, null, 2));
<strong> hooks / after _plugin_rm / 010_deregister_plugin.js
#!/usr/bin/env node /** * Remove plugins from cordovaPlugins array after_plugin_rm */ var fs = require('fs'); var packageJSON = require('../../package.json'); packageJSON.cordovaPlugins = packageJSON.cordovaPlugins || []; process.env.CORDOVA_PLUGINS.split(',').forEach(function (plugin) { var index = packageJSON.cordovaPlugins.indexOf(plugin); if (index > -1) { packageJSON.cordovaPlugins.splice(index, 1); } }); fs.writeFile('package.json', JSON.stringify(packageJSON, null, 2));
<strong> hooks / after _platform_add / 010_install_plugins.js
#!/usr/bin/env node /** * Install all plugins listed in package.json * https://raw.githubusercontent.com/diegonetto/generator-ionic/master/templates/hooks/after_platform_add/install_plugins.js */ var exec = require('child_process').exec; var path = require('path'); var sys = require('sys'); var packageJSON = require('../../package.json'); var cmd = process.platform === 'win32' ? 'cordova.cmd' : 'cordova'; // var script = path.resolve(__dirname, '../../node_modules/cordova/bin', cmd); packageJSON.cordovaPlugins = packageJSON.cordovaPlugins || []; packageJSON.cordovaPlugins.forEach(function (plugin) { exec('cordova plugin add ' + plugin, function (error, stdout, stderr) { sys.puts(stdout); }); });
Another solution is to add a task to install the plugin, as described on this page: http://jbavari.imtqy.com/blog/2014/06/24/managing-cordova-plugins-with-package-dot-json-and- hooks /