Search code examples
cordovaphonegap-pluginsionic-frameworkngcordova

How can I customize Ionic plugins?


I'm using barcodescanner plugin for an app and want to customize some parts of the plugin so I try working directly inside the plugins > com.phonegap.plugins.barcodescannerdir so I make changes to res (layouts) or to src dir (the java files) but no changes are updated in my app when running it on device, I'm trying running from android studio and intellij but no changes appear, I also tried:

 ionic run android

Nothing changes.

Now I saw possible solutions in here I tried ionic build android or cordova prepare android. Fromom the plugins dir then once again ionic run android; nothing changes...

I even tried deleting android.json (as recommended in link) in pluginsdir but that just messes up the project.

This is my project structure:

enter image description here

Inside LibraryProject are the res and src dirs I want to customize stuff in...


Solution

  • Inside the plugins folder you can find the plugins installed on your project. When you add a platform with cordova platform add android or ionic platform add android the plugins will be installed in the platform starting from that folder plugins.

    You could remove the platform and then add:

    cordova platform rm android
    cordova platform add android
    

    Depending what you edited, you could need to rebuild some libs. Some months ago I needed change the window scanning size for the same barcode scanner plugin. In this issue on github I found all instructions to do that.