How to create a project in cordova?

How to create a blank Cordova project using the command-line tool?

Junior Developer Asked on March 21, 2017 in CORDOVA.
Add Comment
1 Answer(s)
  1. Make sure you have Node.js & Cordova installed on your system.
  2. Navigate (cd) to a directory where you store projects on your file system.
  3. Using the Cordova CLI, create a Cordova project named Workshop in a directory named myapp:
  1. cordova create myapp com.yourname.myapp Workshop
  1. Navigate to the project directory:
  1. cd myapp
  1. Add support for the iOS platform (optional)

To be able to build for the iOS platform, the iOS SDK must be installed on your system. If it’s not, you can skip this step and add support for another platform, or simply run the tutorial application in your browser.

    1. Make sure the iOS SDK is available on your system.
    2. On the command line, make sure you are in the myapp directory and type:
  1. cordova platforms add ios
  1. Add support for the Android platform (optional)

To be able to build for the Android platform, the Android SDK must be installed on your system. If it’s not, you can skip this step and add support for another platform, or simply run the tutorial application in your browser.

    1. Make sure the Android SDK and the ant build tool are available on your system. The Android SDK is available here. Both the android and ant tools must be available in your path.
    2. On the command line, make sure you are in the myapp directory and type:
  1. cordova platforms add android
  1. Make sure you are in the myapp directory, and add basic plugins to your projects:
  • cordova plugin add org.apache.cordova.device
  • cordova plugin add org.apache.cordova.console
  1. Examine the directory structure under myapp.
    • The www folder is where you will code your HTML / JavaScript application. Open the index.html file in a browser to see the default application created by the Cordova CLI. You can add code here in your own way.
    • The platforms folder is where Cordova will build your application for different platforms (iOS, Android, etc). The contents of this folder will be automatically generated by the Cordova CLI, and you should never edit code in that directory.
    • Plugins are installed in the plugins directory.
    • Application parameters (name, author, etc) are stored in config.xml.

 

Team Leader Answered on April 26, 2017.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.