Progress will discontinue Telerik Platform on May 10th, 2018. Learn more

Modify the Directory Structure of the Custom Plugin

The Apache Cordova Plugman specification has a recommended directory structure for custom plugins. This structure is not mandatory. To make modifying plugin.xml easier, you can apply the recommended directory structure to your plugin.

Prerequisites

  • Verify that you have downloaded the custom plugin to disk.
  • If archived, verify that you have extracted the custom plugin files in a dedicated folder.

Procedure

  1. In a file explorer, navigate to the dedicated folder where you extracted the custom plugin files.
  2. In the folder, if not present, create the following directories.
    • www
    • src
  3. Move the JS file for the plugin to the www folder.
  4. Based on the target mobile platform, perform the following directory structure changes.

    Target Mobile Platform Suggested Steps
    iOS
    1. In the src directory, create a new directory named ios.
    2. Move H and M files to the new directory.
    Android
    1. In the src directory, create a new directory named android.
    2. In a text editor, open the `JAVA` file for the plugin and in the code, locate the package declaration.
    3. Use the package as a reference to create the directory structure nested in src\android.
      For example, if the package is com.custom.plugin, you need to create new directories to have the following file path src\android\com\custom\plugin.
    4. Move the JAVA file for your plugin to the innermost folder in the newly created directory structure.
    iOS and Android Complete the steps for both platforms.
  5. If the custom plugin contains plugin.xml, leave the file in the root of the custom plugin.
  6. If the custom plugin does not contain plugin.xml, create an empty plugin.xml file in the root of the custom plugin.
    Use a text or a code editor to create the empty XML file.

Example

The custom plugin named Custom Cordova Plugin targets both iOS and Android. The package declaration for the plugin is com.custom.plugin. The following directory structure of the custom plugin resembles the directory structure that the Apache Cordova Plugman specification recommends.

Example of the recommended directory structure for Plugman-compatible plugins

Next Steps

Modify plugin.xml to meet the requirements of the Apache Cordova Plugman specification.

See Also

Start a free trial Request a demo
Contact us: +1-888-365-2779
sales@telerik.com
Copyright © 2016-2017, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.