title: How to add custom cordova plugin in cordova app
body: <p>I used the plugman command to create a plugin in cordova </p>
  
  <p>It created all the necessary files that is required. Then I added the android platform in the plugin. </p>
  
  <p>Then I tried to add it in cordova app. I added it successfully but when I am trying to build the app it is giving following errors</p>
  
  <p><a href="https://i.stack.imgur.com/shDy3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/shDy3.png" alt="enter image description here"></a></p>
  
  <p>What am I doing wrong. How I can add my custom plugin in cordova app.</p>
  
  <p>Following is the code of .java file.</p>
  
  <pre><code> package cordova-plugin-test-cordova-plugin;
  
   import org.apache.cordova.CordovaPlugin;
   import org.apache.cordova.CallbackContext;
  
    import org.json.JSONArray;
    import org.json.JSONException;
    import org.json.JSONObject;
        /**
        * This class echoes a string called from JavaScript.
       */
     public class TestCordovaPlugin extends CordovaPlugin {
  
     @Override
     public boolean execute(String action, JSONArray args, CallbackContext     callbackContext) throws JSONException {
      if (action.equals("coolMethod")) {
          String message = args.getString(0);
          this.coolMethod(message, callbackContext);
          return true;
      }
      return false;
  }
  
  private void coolMethod(String message, CallbackContext callbackContext) {
      if (message != null &amp;&amp; message.length() &gt; 0) {
          callbackContext.success(message);
      } else {
          callbackContext.error("Expected one non-empty string argument.");
      }
  }
  }
  </code></pre>
  
  <p>Here is my plugin.xml file :</p>
  
  <pre><code>        &lt;?xml version='1.0' encoding='utf-8'?&gt;
          &lt;plugin id="cordova-plugin-test-cordova-plugin" version="0.0.1"    xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android"&gt;
           &lt;name&gt;TestCordovaPlugin&lt;/name&gt;&lt;js-module name="TestCordovaPlugin" src="www/TestCordovaPlugin.js"&gt;
  &lt;clobbers target="cordova.plugins.TestCordovaPlugin" /&gt;&lt;/js-module&gt;&lt;platform name="android"&gt;
    &lt;config-file parent="/*" target="res/xml/config.xml"&gt;&lt;feature name="TestCordovaPlugin"&gt;
      &lt;param name="android-package" value="cordova-plugin-test-cordova-plugin.TestCordovaPlugin" /&gt;
    &lt;/feature&gt;&lt;/config-file&gt;&lt;config-file parent="/*" target="AndroidManifest.xml"&gt;&lt;/config-file&gt;
    &lt;source-file src="src/android/TestCordovaPlugin.java" target-dir="src/cordova-plugin-test-cordova-plugin/TestCordovaPlugin" /&gt;
  &lt;/platform&gt;
   &lt;/plugin&gt;
  </code></pre>