Ionic 3 Custom Plugin Issue

Hello!

I am building an android app that will integrate Combain CPS SDK. Our teams decided to use Ionic. Like it so far but it’s a learning path as everything else. To the point.

I’m been spending a lot of time trying to understand building plugins and interacting with it. I managed to get the device plugin and it works and I now understand the basics of the communication. And I just tried to change some stuff in the plugin, so that I could call a function in my UI to greet me, was spening alot of time on that until I realised I had to remove the android platform and add it again.

Is there a way to always re-build the plugins when I build the project?

Removing platform just for a change when developing is pretty non-effecient. I’m a new programmer, no doubt about it.

Thing is I have to add repos and dependencies in my gradle files to download the Combain CPS SDK. And removing and adding those would be lot of work. Or is there a way to specify this somewhere else? Then it would be no problem.

Or am I doing it wrong, should my workflow contain others stuff?

Have a nice day!
/Daniel

See: https://github.com/apache/cordova-plugman

Thanks. Yes I’m already using plugman. I am editing the plugin directly in my Ionic project when I have added it to my project. Maybe that’s not the way to go? Is it something that I have to change the plugin version each time for it to compile in the new stuff?

You should link to a local copy of the plugin and modify the local copy.

For example:

Setup

Development

To clone the project:

git clone https://github.com/ato-team/cordova-plugin-abrakm-sdk.git

To add the plugin to your project:

cordova plugin add --link ../cordova-plugin-abrakm-sdk

To remove the plugin from your project:

cordova plugin rm cordova-plugin-abrakm-sdk

To check your project’s plugins:

ionic cordova plugin ls

You should see output like:

cordova-plugin-abrakm-sdk 1.0.0 "Abrakm SDK Cordova Plugin"
cordova-plugin-compat 1.2.0 "Compat"
cordova-plugin-device 1.1.4 "Device"
cordova-plugin-geolocation 2.4.3 "Geolocation"
cordova-plugin-file 4.3.3 "File"
cordova-plugin-scanbot-sdk 1.3.0 "Scanbot SDK Cordova Plugin"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-statusbar 2.2.2 "StatusBar"
cordova-plugin-whitelist 1.3.1 "Whitelist"
ionic-plugin-keyboard 2.2.1 "Keyboard"

Production

To add the plugin to your project:

ionic cordova plugin add cordova-plugin-abrakm-sdk

To remove the plugin from your project:

ionic cordova plugin rm cordova-plugin-abrakm-sdk

You will experience the occasional issue when working with plugins and sometime it means you need to resort to removing and then adding back platform support.

For example:

Note: If receive a build error stating that XCode ‘Cannot find the file or directory’ you need to:

ionic cordova platform rm ios
ionic cordova platform add ios

Alright, then I understand what I must do :slight_smile: Thanks buddy!