How to Run cordova without android studio
Hello friends, in this post i am going to show you how to run cordova android app without using android studio. Basically, some pepole dont wont to run android studio because of their PC specs. But if they need to run cordova app i will show you how to do that. Follow this post.
First of all we need some dependencies installed.
1.Install SDK tools from official site (command line tools)
After downloading command line tools make sure to extract those in a cmdline-tools folder (important)
The reason to extract those in cmdline-tools named folder is sometimes it wont allow to download dependencies from sdk command line
2. Download and install JDK 8 from official site
https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html
3. Download Gradle
4. Download and extract Apache ant tools (Recommended to extract in C)
https://ant.apache.org/bindownload.cgi
Note – Apache ant tools really not required. But some PCs need to be installed Apache ant to proceed
Those are the dependencies we needed for this process. So now lets start the initialization of those tools.
Initialization steps
Step 1
Go to extracted SDK command lines tools folder and navigate to bin folder. Then open that folder in CMD. (You can simply type cmd in navigation bar on that folder).
Run below line in order to download and install platform tools dependency
sdkmanager “platform-tools” “platforms;android-28”
After that run below line in order to download and install build tools dependency
sdkmanager “build-tools;27.0.3”
Note – In this tutorial i installed platform android-28 and build tools version 27.0.3 because the current cordova support for those dependencies
Step 2
Add environment variables for all installed tools in order to identify by cordova
To add enviroment variables and paths right click on PC and click properties and go to advanced system settings and click on environment variables.
Add Paths for following dependencies.
- JDK
- SDK
- Apache Ant
- Gradle
Go to those dependencies bin folder and copy the path from navigation URL then edit the Path variable and add those dependency paths as below screenshots.
And additionally if needed add emulator directory also to path
Step 3
Now add System variables for following. In this don’t navigate to bin folder. Just copy your dependency URL and add to following variables as below screenshots
Create ANDROID_HOME variable as the name
Add the SDK command lines tools path as the value
Create ANDROID_SDK_PATH as the name
Add same as SDK command lines tools path as the value
Create ANT_HOME as the name
Add Apache Ant path as the value
Ok thats it!!! now go to quasar project. Make sure you have configured the project as cordova app. If not check my previous post about getting started with cordova.
If those are correctly configured, run below code in CMD (inside quasar project) to run the project
quasar dev -m cordova -T android
If you having trouble with emulator please check how to configure emulation with AVD using command line
https://developer.android.com/studio/run/emulator-commandline
Extra Hint
Run cordova project on your real android device
Follow those steps.
- Connect your android device
- Make sure you have turned on the USB debugging mode or turn on by going to developer options
- Install driver for your device (Search your device driver and download) This is important in order to run
- Check whether your device working by typing adb devices in CMD
- If your device listed run the dev code above and cordova will automatically detect your device
- Make sure your device Android version is greater than android 5.0.2
Thanks all! if you have any questions please comment below.