How to reload Self-defined plugin in Cordova/Ionic? - android

I'm using Ionic to build an application, and have built a plugin to linkup the html-side and java-side.
However, every time I make changes to the plugin, I need to ionic platform rm android, than ionic platform add android, hence to refresh the plugin in corresponding android project.
Is there any command or method to help me quickly to achieve such purpose?

Related

How to test cordova plugin while developing?

Can someone suggest a better way to test cordova plugin while developing it.
Right now the plugin is not pushed to github nor npm.
I am adding the plugin to my cordova android project using this command.
cordova plugin add cordova-test-plugin
But if I make any modifications to the plugin in the plugins/ folder, those changes are not reflecting.
How can I test the plugin while making changes.

How to preserve native IOS and Android code changes in Ionic build process

In our Ionic project we have created a few actual native views for IOS and Android. We did this by adding them to the Xcode and Android Studio projects them selves.
We are now having portability problems getting it to run on another machine. It suggests doing a ionic platform rm ios and ionic platform add ios
By doing this all the custom views and functionality applied to the projects directly will be overwritten.
What is the proper way to correct this problem? I understand its likely a plugin, but how would you go about creating a plugin which is an actual native view?

Update Ionic 2 Platform

I have an Ionic 2 app. If I change one piece of .ts code I had to perform the folowing steps:
Remove platform;
Ionic platform add android;
Ionic run android or import gradle on android studio;
This process is very slow. How can automatically change .ts code without remove platform?
You don't have to remove and re-add, just do ionic build android.
In any case your workflow doesn't look right, why are you working with the built platform on android studio instead of just working with the files in your appdirectory?

Is there a way to not rebuild cordova applications when adding a new plugin?

The title is self-explanatory but I will try to explain better.
I have a Cordova app for Android and iOS and I want to add a new plugin without the need to use the command cordova build [insert your platform here] because that command builds all the application and removes the current code and sets the project like the beginning.
How I can add plugins without having to backup all the existing project, build the platform and copy again the code with the plugins properly added?

cordova create VS cordova-ios/bin/create

On OSX I want to create a PhoneGap app to run on iOS and Android.
I installed cordova (3.0.0) and phonegap (3.0.0-0.14.0) using npm.
Following the CLI guide I can create my app using
cordova create hello com.example.hello HelloWorld
then add platforms
cordova platform add ios
cordova platform add android
It works well but I'd like to use XCode as IDE. I read the IOS platform guide and saw I can create my app using
./path/to/cordova-ios/bin/create /path/to/hello com.example.hello HellowWorld
I can't execute that command if the folder already exists, so I removed it first. I then tried adding android to it but it doesn't work (Current working directory is not a Cordova-based project.). I then noticed that the content of the directories are really different depending on the tool used.
Is there an easy way to create an XCode project and still be able to use the CLI to build for Android and iOS?
I was able to create a project for ios using the CLI against the bin directory of the ios platform as in your example EXCEPT, I had to create an empty folder first. Try this..
./create ~/My-Project/name of empty project folder com.example.appname. "Project Name"
You can:
create a project using cordova create projectname
add ios support with cordova platform add ios
navigate to projectname/platforms/ios and open the .xcodeproj file in XCode
to use XCode as the IDE.
cordova platform add ios uses the create script under the covers.
The issue you will run into is that if you make changes to the html, css, or js files under projectname/platforms/ios, you will have to manually push those changes back to projectname/www. Or you can only make changes to projectname/www and use cordova prepare to push them to your ios directory (and your android directory).
You'd also need to decide how you want to handle version control--will you do it yourself with a command line client, or within your IDE?

Categories

Resources