Creating an Apache Cordova Project

To create an Apache Cordova project for use with the Hybrid SDK (Kapsel), use the Cordova command line tool.


Set up your development environment.


You must run the commands from a Windows command prompt, or a terminal window on iOS. See published on non-SAP site.


  1. (Optional) Create a folder to hold your Hybrid SDK (Kapsel) Cordova projects.
    For example, on Windows, C:\Documents and Settings\<your_account>\Kapsel_Projects, or on OS X, ~/Documents/Kapsel_Projects.
  2. (Optional) Open a Windows command prompt or terminal and navigate into the project folder you created.
  3. At the command prompt, enter:

    cordova create <Project_Folder> <Application_ID> <Application Name>

    Use the appropriate delimiter for path names.

    This command may take a few minutes to complete, as an initial download of the template project that is used is downloaded to C:\Users\user\.cordova on Windows, or ~/users/user/.cordova on Mac.

    The parameters are:

    • (Required) <Project_Folder> – the directory to generate for the project.
    • (Optional) <Application_ID> – must match the Application ID as configured on SAP Mobile Platform Server for the application, which is reverse-domain style, for example,
    • (Optional) <Application_Name> – name for the application.

    In this example, you create a project folder named LogonDemo in the Kapsel_Projects directory. The Application ID is "com.mycompany.logon" and the application name is "LogonDemo." Running cordova -d allows you to see the progress of the project creation.

    cordova create ~\Kapsel_Projects\LogonDemo com.mycompany.logon LogonDemo

    Your new project includes scripts to build, emulate, and deploy your application.

  4. To add the platform, change to the folder you created in the previous step:
    cd <~Project_Name>
    This OS X example adds the Android , iOS, and Windows platforms.
    cd ~\Kapsel_Projects\LogonDemo 
    cordova platform add ios android windows
    The project directory structure is similar to this:
    |-- merges/
    | |-- android/
    | `-- ios/
    |-- platforms/
    | |-- android/
    | `-- ios/
    |-- plugins/
    |-- www/
     -- config.xml
    • .cordova – identifies the project as a Cordova project. The command line interface uses this folder for storing its lazy loaded files. The folder is located immediately under your user’s home folder (On Windows, c:\users\user_name\ , and on Macintosh, /users/user_name/.cordova).
    • merges – contains your Web application assets, such as HTML, CSS, and JavaScript files within platform-specific subfolders. Files in this folder override matching files in the www/ folder for each respective platform.
    • www – this folder contains the main HTML, CSS, and JavaScript assets for your application. The index.html file is the default page of the application. Once you finish editing your project's files, update the platform specific files using the cordova -d -prepare command.
    • config.xml – the config.xml file in the root directory contains meta data and native application information needed to generate the application.
    • platforms – native application project structures are contained in subfolders for the platforms you added to your application.
  5. (Optional) You can test your Cordova project by opening it in the respective development environment, for example, Xcode or Android Studio, and running it on the simulator or emulator. If you are going to import your project into Android Studio, you must run cordova build android.
  6. Add the plugins. See the detailed instructions for adding each plugin in Hybrid SDK (Kapsel) Plugins. For example, to add the Cordova console plugin and the Hybrid SDK (Kapsel) Logon plugin on Windows, enter:
    cordova plugin add
     cordova plugin add C:\SAP\MobileSDK3\KapselSDK\plugins\logon 
  7. Edit the Web application content in the project's www folder and use the cordova prepare command to copy that content into the Android, iOS, and Windows project folders:
    cordova prepare android
    cordova prepare ios
    cordova prepare windows