Previously we discussed the Apache Cordova basics and created a simple app using it. But we did not run it on the real Android device or emulator. Let’s follow this simple tutorial.
Install and set up Android SDK
Every mobile platform provides the SDK – software development kit. Android is not an exception. You need to download Android SDK and install it on your computer.
When you have SDK installed, you need to set 2 system properties:
- ANDROID_HOME with a path to SDK folder.
- Update PATH property by adding path to tools and platform-tools directories.
Run Cordova app on Android
When you’re done with SDK you can move on straight to running Cordova applications on Android. There are 2 ways:
- run the app on a real device
- run on the emulator
Emulator is a part of SDK. If you have no devices connected to your computer Cordova will launch the emulator.
At first we should have an Android platform added to a Cordova project:
> cordova platform add android
The command of running the app is the same. Open your project folder in a command-line terminal and execute:
> cordova run android
If you prefer the emulator, note that system need some time to launch it (1 – 5 minutes). When installation is finished the result should look like this: