How To Install third party plugins into Cordova 3.3.0 (aka PhoneGaps)

I assume you already know, How to install cordova 3.0 inbuilt plugins using CLI, If not please read cordova documentation here

My example is purely based on Git-hub plugins, For my project i am using Facebook and TelephoneNumber

In order to get any plugin hosted on Git-hub, you need to download GitHub on your desktop (windows), Once installed, browse installed directory and find Git Shell on your computer, now from CMD Shell (Git Shell), browse your phonegaps code directory and type following for TelephoneNumber.

        
	
$cordova  plugin add https://github.com/macdonst/TelephoneNumberPlugin.git
	

You should see something like below :

        
	
Fetching plugin "https://github.com/macdonst/TelephoneNumberPlugin.git" via git clone
Starting installation of "com.simonmacdonald.telephonenumber" for android
Preparing android project

com.simonmacdonald.telephonenumber installed on android.
	

Now check all plugins and ensure if this plugin is installed or not.

        
	
 $ cordova plugin ls
        
        [ 'com.simonmacdonald.telephonenumber',
        'org.apache.cordova.camera',
        'org.apache.cordova.device',
        'org.apache.cordova.dialogs',
        'org.apache.cordova.file',
        'org.apache.cordova.file-transfer',
        'org.apache.cordova.geolocation',
        'org.apache.cordova.media-capture',
        'org.apache.cordova.network-information',
        'org.apache.cordova.splashscreen',
        'org.apache.cordova.vibration' ]
	

Note* You might see error message like

        
	
"[Error:Error fetching plugin:Error: git command line is not installed]"
	

Which means that you have not installed git-hub on your desktop. if you want to use git command first you need to install git command line tool. then you can add plugins as per your requirements.

Note** You might also see error message like below

        
	
Fetching plugin "https://github.com/danwilson/google-analytics-plugin.git" via git clone
Error: Command failed: fatal: could not create work tree dir 'C:\Users\SMOHATAD(in my case it on my name, it will be different in yours)\AppData\Local\Temp\plugman\git\1397683376354'.: No such file or directory

Try to create the directory manually, Looks like there is a bug with in git source dependencies on Windows, Please do following

        
	
mkdir C:\Users\SMOHATAD\AppData\Local\Temp\plugman\git

Once Directory is created then try to add plugin

        
	
cordova  plugin add https://github.com/macdonst/TelephoneNumberPlugin.git

Hope this is Helpful.

Thanks

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s