Search code examples
cordovaionic-frameworkcordova-pluginsngcordova

how to install cordova plugin through github url and set its configuration in config.xml


<plugin name="cordova-plugin-intent-action" spec="git+https://github.com/ngocdaothanh/cordova-plugin-intent-action.git" />
<plugin name="co.mylonas.cordova.applicationstate" spec="git+https://github.com/leomylonas/cordova-plugin-applicationstate.git" />

I'm trying to install those two plugins in my cordova application. When I run command cordova plugin add --PluginName@gitURL-- it works. But when I run cordova platform add android, it gives me the following error.

enter image description here

Before I was using cordova 6.1.1 and node 6.9.5 and everything worked well. But after upgrading both, I'm seeing this issue.

NOTE: I'm using cordova 7.1.0 node 8.9.1 npm 5.5.1


Solution

  • git+https is a scheme only used by the git client. Just remove the git+ part.

    However I do not recommend you use remote repositories for plugins, because twice now, I have had such repositories disappear, either due to a name change, or it's simply deleted.

    I suggest you clone it to a local path, check-out the desired tag/branch, remove the internal .git directory from it and commit the whole thing to your main project. You can add it as

    <plugin name="the-plugin-name" spec="stored-plugins/that-important-plugin" />