Add plugins using cli in cordova 2.5.0 - ios

I have tried my best to add a plugins using Command line interface in cordova 2.5.0 but failed to find any solution can u please help me to add plugins

I don't believe you can use the command line to manage cordova 2.5 projects. The node base CLI didn't get added to the project until cordova 2.9.0.
You need to manually add plugins as outlined here: https://cordova.apache.org/docs/en/2.5.0/guide_plugin-development_index.md.html#Plugin%20Development%20Guide

Related

ionic: add own cordova plugin

I modified an existing cordova plugin and want to integrate it now into my application.
I already created a link to my source directory
cordova plugin add --link ~/path/to/plugin
but now I can not find my plugin in my project. I suggest, that the plugin needs to be build?
Is it needed to modify my package.json?
Add the plugin to project:
ionic cordova plugin add [plugin]
Documentation
Install and save the plugin:
npm install --save [plugin]
Example
This is related to stackoverflow/questions/30345035
Since you modify existing plugin there is possibility that you didn't modify it right. Also there is possibility that plugin is not working for specific platform version.
If you are looking to add your own cordova plugin in Ionic v2 here can be your solution.
If you have exported your module / plugin like
module.exports = new YourPluginJavaClass();
then you will be able to use it in your Ionic application as
(window as any).YourPluginJavaClass.yourFunction();
Please see this link as well
Hope this helps.

The plugin command has been renamed

After installing Ionic last version 3.1.2 I tried to add the Native Geolocation plugin and I got the following:
ionic plugin add cordova-plugin-geolocation
The plugin command has been renamed. To find out more, run:
ionic cordova plugin --help
I will appreciate any help on this.
Thanks in advance
According to the docs, the command for ionic cli version 3 is:
ionic cordova plugin add cordova-plugin-geolocation

Cannot add Plugins to my iOS Cordova Application

I have a cordova 3.3.0 application that I created using ./create etc etc now Whe i try to add the device plugin either phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git
or
cordova plugin add org.apache.cordova.console org.apache.cordova.device all give me errors, the device plugin is essential to my application. Anyway to add that plugin without using the CLI tools? just git cloning? or a quick fix? I have killed a lot of time on this.
I think you should follow thier new way to add plugins like Device:
phonegap local plugin add org.apache.cordova.device

cordova console log can not be installed

I am trying to install the cordova console.log plugin.
when i am trying to install it using the command line using:
cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-console.git
I am running it from the path of the root application path
the structure of the folder is:
projName
|-- --project
|-- projName
|-- cordova
|-- CordovaLib
|-- projName.xcodeproj
|-- plugin
And the error i receive in the command line is
[Error: Current working directory is not a Cordova-based project.]
i should mention that i build the cordova project manually using imports of the frameworks because in the xcode new project window there was not Cordova/Phonegap new project option.
I am using xCode 5.0.1 and cordova 3.1.0
The error you get is self-explanatory, it is because you have not created a cordova project as it must be created. Keep reading to solve the problem.
Cordova basic project preparation steps
Based on my comment and your answer, you should follow the cordova workflow for creating projects using the CLI (command line interface), it is strongly recommended to avoid unnecessary problems, and the steps are not hard to follow.
Please follow the steps described here (official doc), read it fully, it will save you more time later if you read it:
http://cordova.apache.org/docs/en/3.2.0/guide_cli_index.md.html#The%20Command-Line%20Interface
In brief the steps are:
Install node.js
Install cordova using npm
Create a cordova project / app using the CLI
Add the desired platform to the project (android, ios, etc, as needed)
Work on your project
Add cordova plugins as necessary (for example if you need notifications add the notificacion plugin)
Build the project
Test of device or emulator (in your case iPhone, iPad simulator)
iOS Platform Guide
Also check the iOS Platform Guide completely, it is very helpful, explain additional instructions to prepare and work with XCode.
http://cordova.apache.org/docs/en/3.2.0/guide_platforms_ios_index.md.html#iOS%20Platform%20Guide
Plugins
For each plugin in the API reference you will find instructions to install them using the CLI, as well as to "uninstall" them.
Only install the plugins you will need
Just for reference, the code to install notifications-dialogs plugin using the terminal (run the command inside your project folder):
$ cordova plugin rm org.apache.cordova.dialogs
On the other hand, the easier way to solve the problem is create the new project following the noted steps and later just add your existing code or files to the proper folders, as well as add the required plugins, not that difficult.

Add SQLite Plugin to Phonegap 3.0 from commandline

I am using Phonegap 3.0 for my latest project. I tried to add the native sqlite database plugin to prepopulate data from an existing database. The issue is i could install the plugin through commandline . It showed the following error:
#phonegap local plugin add https://github.com/jarlehansen/PhoneGap-SQLitePlugin-iOS.git
adding the plugin:
https://github.com/jarlehansen/PhoneGap-SQLitePlugin-iOS.git
fs.js:427 return binding.open(pathModule._makeLong(path),
stringToFlags(flags), mode);
^ Error: ENOENT, no such file or directory '/var/folders/7j/1qkbsztx3_bgtslq3pnnr9jc0000gn/T/plugman-tmp1383202788796/plugin.xml'
at Object.fs.openSync (fs.js:427:18)
at Object.fs.readFileSync (fs.js:284:15)
at Object.module.exports.parseElementtreeSync (/usr/local/lib/node_modules/phonegap/node_modules/cordova/node_modules/plugman/src/util/xml-helpers.js:119:27)
at /usr/local/lib/node_modules/phonegap/node_modules/cordova/node_modules/plugman/src/util/plugins.js:67:39
at /usr/local/lib/node_modules/phonegap/node_modules/cordova/node_modules/shelljs/shell.js:1707:7
at ChildProcess.exithandler (child_process.js:635:7)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:735:16)
at Socket.<anonymous (child_process.js:948:11)
at Socket.EventEmitter.emit (events.js:95:17)
I tried to manually install the plugin by importing the header files and main files and js file and then by adding feature to config.xml. But that also was a failure,.
Please Help me out to install this plugin in Phonegap 3.0
Within Cordova you can install the plugin from remote location like this:
cordova plugin add https://github.com/brodysoft/Cordova-SQLitePlugin.git
But I guess you need Git locally installed as a prerequisite. Not sure how the PhoneGap command looks like. Credits go to here.
First thing that comes to my mind when there is no such file or directory is that the directory doesn't exist because whatever tried to create it did not have proper permissions.
Try checking the permissions (this may just be a matter of running it with 'sudo')
It's a longshot, but i found that sometimes the install worked only when i used the cordova command line. download its bin and try the following:
cordova install --platform <android/ios> --project <project dir> --plugin <plugin's git>
I got is solution by using this plugin https://github.com/lite4cordova/Cordova-SQLitePlugin
which offers adding though Cordova CLI commands.

Resources