Cordova Project Creation and Building Commands Using Node JS CLI

By | December 16, 2016

Cordova helps us to make the mobile development more user friendly and easy. Due to the demand of mobile applications we saw that most of the companies are having their own Mobile Application weather its useful or not.

Cordova helps us to create Mobile Application development using Javascript/HTML. Cordova  allows you to easily write one set of code to target nearly every phone or tablet on the market today and publish to their app stores. Here in this tutorial i will show you some commands which will help you to create a project and build the APK of your project.

I have used some of the tools for working which i am writing here.

  1. JDK
  2. Android SDK
  3. Set Environment Variable
  4. Set Emulator
  5. Netbeans for my code part
  6. Node Js CLI for running the Cordova Commands

Lets start the Command part.

Open Node JS CLI for running the commands. Navigate to the folder where you want to the create the project folder.

For creating the project folder we will write

cordova Create FolderName com.example.example ProjectName

Now navigate to the project folder.

cd ProjectName

Now we will add the platform in this tutorial i am adding the Android Platform.

cordova platforms add android

cordova platforms add android @ 5.0.0

These both the code add the android platform just a small difference. When you need a specific android platform just use the 2nd line else first one also works for you.

If you want to check added platforms than write this command.

cordova platforms ls

Now we have created the project folder and added the platforms. If we want to add any plugin than we will write. ex – we will add a toast plugin

cordova plugin add cordova-plugin-x-toast

If you want to remove the plugin.

cordova plugin remove cordova-plugin-x-toast

If you want to see the list of plugins which you are using in your project than write

cordova plugin list

After the project finishes we need an APK to test it over our cell phone. So for creating the Build we will write

cordova Build or cordova build android

After the build if you want to run the application over you pc than you have to write.

cordova emulate android

emulate command will work if you earlier setup the Emulator.

Thats all friends in this tutorial you will see some commands to create the Cordova Project and Build it for your mobile device.

In the next part we will show you how you can create the Signed APP for Google Play Store.

Leave a Reply

Your email address will not be published. Required fields are marked *