Cordova_plugins.js not updating after adding a new plugin

I just started using cordova with android.

I have a problem adding plugins.

I used the cordova plugin to add org.apache.cordova.camera from cmd to Win7. It is added, but not to the cordova_plugins.js file.

The file is updated when I type corova run android in cmd, but then all my code is deleted and replaced with a skeletal web application. Why is this happening? How to automatically update this file?

This is what my cordova_plugins.js looks like:

cordova.define('cordova/plugin_list', function(require, exports, module) { module.exports = [ { "file": "plugins/org.apache.cordova.dialogs/www/notification.js", "id": "org.apache.cordova.dialogs.notification", "merges": [ "navigator.notification" ] }, { "file": "plugins/org.apache.cordova.dialogs/www/android/notification.js", "id": "org.apache.cordova.dialogs.notification_android", "merges": [ "navigator.notification" ] }, { "file": "plugins/org.apache.cordova.vibration/www/vibration.js", "id": "org.apache.cordova.vibration.notification", "merges": [ "navigator.notification" ] } ]; module.exports.metadata = // TOP OF METADATA { "org.apache.cordova.dialogs": "0.2.5", "org.apache.cordova.vibration": "0.3.6" } // BOTTOM OF METADATA }); 

As you can see, there is no camera plugin. It is added to my project, but not in this file, and for this reason it does not work when I try to use it in my js files.

I hope you understand what I'm talking about.

+7
android cordova phonegap-plugins
source share
3 answers

It appears in the list as you type:

 cordova plugin ls 

You re-run:

 cordova build wp7 
+1
source share

What worked for me:

  • Delete / platforms [or move to another location as a backup]
  • Delete / plugins [or move to another location as a backup]
  • Assembly, for example: ionic cordova build android --prod or ionic cordova prepare
  • This resets everything, selects FRESH plugins from config.xml

PS: add / remove / update versions of plugins and packages from package.json and run npm i in advance.

You may need to update config.xml with the correct versions (if you are trying to fix the version conflict)

+1
source share

I had the same problem with another plugin and I did an old and magic trick: I restarted Windows (Windows 7)

After restarting Windows, I followed these steps:

  • All plugins removed (I don't know if I need to remove them)
  • Removed cordova_plugins.js
  • I executed platforms /android/cordova/clean.bat
  • The Mi plugin had a dependency (Inappbrowser), so I installed Inappbrowser first.
  • I installed the plugin

I don't know if all these steps are needed, maybe it just restarts Windows. However, this worked for me.

0
source share

All Articles