Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Phonegap/Cordova 3.0+, is there any way to refresh plugins after you make changes?

Tags:

cordova

Sorry guys if this is a simple question, which I'm hoping it is. The PhoneGap/Cordova documentation is pretty bad.

So with the directory structure:

/platforms/
   /ios/
   /android/
/plugins/
/www/

Is there anyway to make changes in the parent plugin directory and then have it apply those changes to the different platforms? I'm doing:

cordova prepare

This updates all the HTML from the parent www directory, but my plugins don't seem to get updated.

Hopefully someone can chime in with and give me a "doh!" moment.

like image 446
normmcgarry Avatar asked Nov 21 '13 21:11

normmcgarry


People also ask

How do Cordova plugins work?

A plugin is a package of injected code that allows the Cordova webview within which the app renders to communicate with the native platform on which it runs. Plugins provide access to device and platform functionality that is ordinarily unavailable to web-based apps.


3 Answers

I'm asking myself this question for a long time, and finally did a little script to make sure everything is up to date:

rm -rf -- platforms/*/
rm -rf platforms/platforms.json

rm -rf -- plugins/*/
rm -rf -- plugins/android.json
rm -rf -- plugins/ios.json
rm -rf -- plugins/fetch.json

cordova prepare

Have not found anything better yet

like image 124
Sebastien Lorber Avatar answered Nov 10 '22 02:11

Sebastien Lorber


I ran into the same issue. The only way I could consistently get my plugin to update would be to uninstall the plugin completely and reinstall it from scratch.

cordova plugin rm org.apache.cordova.plugin.example
cordova plugin add ../example-app-plugin/

In this example I am installing it from a local directory.

like image 29
Noah Avatar answered Nov 10 '22 00:11

Noah


Try:

cordova plugin add ../example-app-plugin/ --link

This will work if you are not adding or removing files from your config.xml - in which case, rm/add seem to be the way to go. So if your file structure is pretty much settled, that should get the job done for you.

like image 23
Marc Trudel Avatar answered Nov 10 '22 02:11

Marc Trudel