Skip to content

Instantly share code, notes, and snippets.

@rupeshtiwari
Last active December 7, 2023 01:31
Show Gist options
  • Save rupeshtiwari/a4b78077a6bfb6db88bcb09c469372db to your computer and use it in GitHub Desktop.
Save rupeshtiwari/a4b78077a6bfb6db88bcb09c469372db to your computer and use it in GitHub Desktop.
Getting Started with Cordova | Create Your First Android/IOS Application
.vscode/settings.json

cordova installation guide on windows

Getting Started With Cordova on Windows

Cordova Full Course- The Complete Step by Step Guide to creaste your first Android app & Deploy in Google Play. You will learn How to Publish App (HTML/CSS/JS) code to Google Play Store - Cordova. Publish REACT / ANGULAR / VUE JS App to Google play. Learn How to convert web app to android app without any code change and publish it in few steps.

  1. Installing Cordova On Windows Machine
  2. Creating your First Cordova Project

Installation Guide for Cordova On Windows

๐Ÿ‘‰๐ŸปStep1 Installing Cordova on Windows

  • Install Node.js ( get the download file from http://nodejs.org)
  • Confirm Node.js is installed by running node --version
  • Install Git ( get the download file from http://git-scm.com. )
  • Install Cordova Npm Package run the script npm i -g cordova ( Make sure you open cmd / powershell on administrator mode ) installing cordova on windows
  • Confirm Cordova is installed by running cordova --version check cordova version

๐Ÿ‘‰๐ŸปStep2 Installing Java Development Kit (JDK) on Windows

You need to install Java Development Kit (JDK) If you already have installed it then check it by running below script in cmd or powershell:

    javac -version

If JDK is not installed you will see below error:

C:\Windows\system32>javac -version
'javac' is not recognized as an internal or external command,
operable program or batch file.

In order for installing go to Download Java Development Kit from here!

JDK 12.0 exe Download Direct Link

https://download.oracle.com/otn-pub/java/jdk/12.0.1+12/69cfe15208a647278a19ef0990eea691/jdk-12.0.1_windows-x64_bin.zip

Step 2: Install JDK & Configure Environment Variables

  • Download the JDK EXE and install it on your local machine.

  • Once JDK is installed then go to the windows environment variables

    • Add the jdk bin folder path (C:\Program Files\Java\jdk-12.0.1\bin) in both user and system path in Windows Environment Variables.

      • Search for edit environment variables in windows
      • configuring environment variables for jdk bin folder configuring environment variables for jdk bin folder
    • Add new entry called as JAVA_HOME with Value being the installed location of the JDK for me it is C:\Program Files\Java\jdk-12.0.1 create java home on windows environment variables confirm java home on environment variables

    • Confirm JDK Installation Run below script to check JDK Installed:

      • Run Below SCRIPT on Admin Command Prompt/Powershell
      javac version

      confirming java jdk installation

๐Ÿ‘‰Note: You many need to restart your machine if you do not see java version on command prompt.

๐Ÿ‘‰๐ŸปStep3: Install Android Studio

Please use your own folder path while updating environment variables.

  • Go to Android Studio Download Page and download android studio exe file. https://developer.android.com/studio/index.html

    Android Studio Download Page

    Install android studio Now!

  • Update Window Environment Variables by adding sdk tools & platform-tools folder path that is below 2 Entries in User Variables

    • C:\Users\rtiwari\AppData\Local\Android\Sdk\tools
    • C:\Users\rtiwari\AppData\Local\Android\Sdk\platform-tools add tools and platform tools in environment variables
  • Add ANDROID_HOME variable to both in User & System Environment Variables pointing to SDK folder: C:\Users\rtiwari\AppData\Local\Android\Sdk

  • Confirm Android Studio is installed by running below script

    • adb version You should see this output: Android Debug Bridge version 1.0.41 Version 28.0.3-5475833 android studio installation confirmation

    ANDROID HOME

Create your First Android App using Cordova

๐Ÿ‘‰๐ŸปStep1 Create a Cordova Project

In order to publish your android app you need to first create an cordova project.

Cordova app naming convention is as described below: Cordova App Naming convention

<appname com.domain.project appname>

Example :product-mart com.rupeshtiwari.productmart product-mart

Go to desired folder location where you want to create project. Open powershell/cmd in admin mode.

๐Ÿƒ๐ŸปRun below script to create project

cordova create product-mart com.rupeshtiwari.productmart product-mart

Create Cordova Project Run Script

Open project in Visual Studio Code

Open project in Visual Studio Code

๐Ÿƒ๐ŸปRun npm i to install dependencies.

๐Ÿ‘‰๐ŸปStep2 Add Platform Folders

1. Add Android Platform

๐Ÿƒ๐ŸปRun below script to create android platform

cordova platform add android

 Add Android Platform Script

๐Ÿ‘ฎ๐Ÿป Check your Project platform folder

Android platform folder explore

2. Add Browser Platform

๐Ÿƒ๐ŸปRun below script to create Browser platform

cordova platform add browser

 Add Android browser Script

๐Ÿ‘ฎ๐Ÿป Check your Project platform folder

Android bro browser explore

@ientropic
Copy link

Is there a second part to this? It stops after adding the browser platform.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment