Anyone knows what is the proper way to update cordova plugin in my cordova/phonegap project? Some time ago I installed file plugin as:
cordova plugin add org.apache.cordova.file
Everything worked fine. Now I realized there is a new version of the file plugin, so I wanted to update to get the new functionality. However, I haven't found a decent way to update. Actually, I can't update at all.
When I run remove command as:
cordova plugin rm org.apache.cordova.file
I get the following message:
Deleting plugin org.apache.cordova.file
No dangling plugins to remove.
What is interesting is that if I run
cordova plugin
right after, I still see org.apache.cordova.file in the list of installed plugins. Also, there is no single change on a file system. Nothing is removed, no file is updated.
Then I try to add a plugin again (as for updating the plugin is advised to remove it and add again) with:
cordova plugin add org.apache.cordova.file
Which outputs:
Fetching plugin "org.apache.cordova.file" via plugin registry
Plugin "org.apache.cordova.file" already installed on android.
Plugin "org.apache.cordova.file" already installed on ios.
And, even though this brings new version of java and javascript files (and some others), as I would expect, it brings them to myproject/plugins folder only.
It doesn't update files in platform folders (myproject/platforms/android/assets/www/plugins and myproject/platforms/ios/www/plugins) where it installed the files I installed them the first time.
Thus my project still keeps using the old version of the plugin.
So I wonder, how to update plugins. Any idea? Do I have to copy them manually to platform folders? Is this documented anywhere?
Thanks in advance.
So eventually I found the issue.
It seems, that there is a some sort of dependency between org.apache.cordova.file
and org.apache.cordova.file-transfer
. So if file-transfer
plugin is installed, file plugin will not be removed, hence not updated if platform folders.
The solution is to remove file-transfer
plugin first and then remove file plugin. Then adding file and file-transfer
plugins will update those plugins in all platforms correctly, as one would expect.
Took some time to figure out, but does the trick.