Search code examples
androidcordovaphonegap-pluginscordova-3

How to add our own made plugin in cordova 3.1 project though Cordova CLI for android platform?


I am able to add the plugin which is designed by Apache though cordova command line interface for android platform. But I could not able to add the plugin which are designed by own though the CLI. please help me sort out to add plugins which is made by own in cordova3.1 project.


Solution

  • After a lot of struggle I found the solution for the above problem.

    1. Create Cordova Project(suppose CordovaDemo) through CLI
    2. Add the platform android
    3. Add the your own plugin your.js file inside the js of CordovaDemo/www/js/your.js
    4. Edit the CordovaDemo/www/index.html Add below script tag

      < script type="text/javascript" src="js/your.js">

    5. Add your YourPlugin.java file inside the src of your android platform

    6.Add this inside res/xml/config.xml

     < feature name="YourPlugin">
    
               < param name="android-package" value="yourpackage.YourPlugin" />
    
           < /feature>
    

    Import android project in eclipse and run