I need to run ionic platform add android/iOs
few times to get the desired result.
Sometimes plugins are added after first run, but usually I have to wipe out the plugins and platform directories and re-run adding the platform cycle few times until all plugins are added to android folder.
Did anyone else experienced same problem and if yes - what is the resolution? if any ...
thanks in advance
I've experienced some similar problems myself. Try reseting your ionic project:
This removes the
platforms/
andplugins/
folder and restores them from the information stored in yourpackage.json
. There's a few other useful commands documented on the ionic-cli project.The solution that I ended up using is to uninstall and reinstall all the plugins after adding the platform. Since I've had trouble with this issue in past Cordova apps, I'm trying to make the builds as consistent as possible, so I'm not committing the platforms directory and deleting it after I build the apk. I've done this with a script:
This has consistently worked for me, but since I'd rather not have to worry about keeping this current, I have moved these commands into the: after_platform_add/010_install_plugins.js, with the following additions:
This assumes that something along these lines exists in the package.json in the root JSON object:
Which should occur automatically if the after_plugin_add/010_register_plugin.js is working properly.
All that said, I feel like this is kind of hacky and that Ionic should be handling all this properly, so hopefully I can find some time to look into this issue on that side of things and find the root issue of this problem.
It is better now to use
ionic cordova prepare
This installs and configures all plugins in a single step
I think I have found solution to this issue. Instead of using ionic cli for adding platform I'm using
sudo cordova platform add ...
. It's working every time.