Ionic plugin needs to remove the platform and read the platform before it works

I have package.json like this,

"cordovaPlugins": [ "com.ionic.keyboard", "org.apache.cordova.camera", "org.apache.cordova.console", "org.apache.cordova.device", "org.apache.cordova.dialogs", "org.apache.cordova.file", "org.apache.cordova.file-transfer", "org.apache.cordova.geolocation", "org.apache.cordova.network-information", "org.apache.cordova.splashscreen", "cordova-plugin-whitelist", ], "cordovaPlatforms": [ "ios", "android" ] 

There is no plugin and platform directory in the project root directory when I exit the repository. so I run the "ion add android platform" which will create a platform directory and install the plugin.

But this will not work until I launch the “ionic platform rm android” and then “the ionic platform adds android”, suddenly it works fine.

What does it mean? and how to solve this, so the next developer can pull out the repo and directly make it work just by running the "add android ionic platform" once?

I use the latest cordova

+9
android cordova cordova-plugins ionic-framework ionic
source share
3 answers

You can add all your plugins using the --save option:

 cordova plugin add com.ionic.keyboard --save cordova plugin add org.apache.cordova.camera --save 

etc.

Or you can do it after adding your plugins:

 cordova plugin save 

You can do the same for your platform:

 cordova platform add android --save 

or later:

 cordova platform save 

these commands will add several new sections to your config.xml file:

 <plugin name="org.apache.cordova.device" spec="^0.3.0" /> ... 

and

 <engine name="android" spec="^4.0.0" /> 

Now you can remove the platforms and plugins and run:

 cordova prepare 

and he should create a platform and download all the plugins for you.

Here you can find additional information.

+13
source share

The following steps helped me

 ionic platform rm android ionic platform add android ionic plugin add https://github.com/apache/cordova-plugin-whitelist.git ionic build android 

Then you can deploy your apk

+6
source share

Next Steps Step 1: C: \ Users \ vipin> cd C: \ Users \ vipin \ Documents \ GitHub \ Applozic-Server \ Applozic-Ionic-Chat-Plugin

// change the directory where your application is located

Step 2: the ion platform adds android // or ios ex: C: \ Users \ vipin \ Documents \ GitHub \ Applozic-Server \ Applozic-Ionic-Chat-Plugin> the ion platform add android

Step 3: ion collector ex: C: \ Users \ vipin \ Documents \ GitHub \ Applozic-Server \ Applozic-Ionic-Chat-Plugin> android ion collector

Step 4: if you want to remove your platform. follow this step C: \ Users \ vipin \ Documents \ Github \ Applozic-Server \ Applozic-Ionic-Chat-Plugin> ionic platform rm android

Note: again you want to add the platform. go to step 1 - step 3

+1
source share

All Articles