I just started using cordova with android.
I have a problem when adding plugins.
I used cordova plugin to add org.apache.cordova.camera from cmd in Win7. It is added but not in cordova_plugins.js file.
File is getting updated when I type cordova run android this in cmd but then all my code is deleted and replaced with skeletal web-based application. Why is this happening? How to automatically get this file updated?
This is how 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 in my project, but not in this file and that's reason it is not working when I try to use it in my js files.
I hope you understood what I am saying.
Does it show up in the list when you type:
cordova plugin ls
Did you rerun:
cordova build wp7
What worked for me:
- Delete ./platforms [or move to some other place as a backup]
- Delete ./plugins [or move to some other place as a backup]
- Build e.g:
ionic cordova build android --prod
orionic cordova prepare
- This resets everything, fetches FRESH plugins from config.xml
PS: add/remove/update versions of plugins and packages from package.json
and run npm i
beforehand.
You might need to update config.xml with the right versions too (if you are trying to fix a version conflict)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With