How to install the developer tools to build Android apps with Cordova
Construct 2/3 lets you build Android apps using a technology called Cordova.
Ok, but what is Cordova?
Cordova is an open-source mobile development framework. It allows you to use standard web technologies - HTML5, CSS3, and JavaScript for cross-platform development. You can see all the details at https://cordova.apache.org
Through a series of blog entries, I'm going to describe how to use the Cordova CLI (command-line interface) to build Android apps locally. Although it's not easy to work with it, the Cordova CLI allows full control over the build process, offline builds and use of any third-party Cordova plugins.
This entry will cover how to install the tools needed for the build process.
- Prepare our Windows system
- Install Node.js
- Install Git
- Install Cordova CLI
- Install Java SE Development Kit 6
- Install Java SE Development Kit 8
- Install Android Studio
- Configure Android SDK
1. Prepare our Windows system
Our clean slate it's going to be a fresh install of Windows 10 Professional with the october 2018 update
Version: 1809
Build: 17763.292
Architecture: x64
This way we can guarantee there will be no Windows related errors.
2. Install Node.js
Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine.
We're going to download Node.js version 10.15.0 from https://nodejs.org/en/
Be sure to select the x64 version.
Now we're going to install it using the default settings.
3. Install Git
We're going to download Git version 2.20.1 from https://git-scm.com/download/win
Be sure to select the x64 version.
Now we're going to install it using the default settings.
4. Install Cordova CLI
We're going to install the Cordova CLI version 7.1.0
Ok, but why install the old v7.1.0 instead of the newest one?
The plugins that I use (--nofetch
Extract taken from Cordova's blog:
Starting with Cordova v7.0.0:
Fetch is now the default method for fetching platforms. Fetch uses your npm
npm install
--fetch
--nofetch
flag to revert to pre-Cordova@7.0
behavior (npm install
is not used to fetch modules).
You can see all the details on the release notes:
https://cordova.apache.org/news/2017/05/04/cordova-7.html
Extract taken from Cordova's blog:
Starting with Cordova v8.0.0:--nofetch
cordova-fetch
npm@2
dependency we were shipping with Cnpm
You can see all the details on the release notes:
https://cordova.apache.org/news/2017/12/18/tools-release.html
To install the Cordova CLI v7.1.0 open a command prompt window and type npm install -g cordova@7.1.0
5. Install Java SE Development Kit 6
We're going to download Java SE Development Kit 6 Update 45 (which is the last version of the Java 6 series) from Oracle Archive Downloads
Be sure to select the x64 version.
In this case, we don't need the "Public JRE" feature, so we deselected it from the setup, for the rest we'll use the default settings.
6. Install Java SE Development Kit 8
We're going to download Java SE Development Kit 8 Update 202 from Oracle Archive Downloads
Be sure to select the x64 version.
Now we're going to install it using the default settings.
7. Install Android Studio
We're going to download Android Studio 3.3 from Android Developers
Be sure to select the x64 version.
Now we're going to install it using the default settings.
We're going to start Android Studio after it has been installed.
In this case, we're not going to import settings.
Now we're going to setup Android Studio using the default settings.
We verify the settings and proceed with the installation.
8. Configure Android SDK
Installing the Android SDK doesn't automatically include all the minimum required packages for developing. While individual developer needs vary you should install the "SDK Platform" for the Android versions you've set as
Example #1
Target API 23.
Minimum API 23.
Only need to install SDK Platform for API 23.
Example #2
Target API 23.
Minimum API 15.
Need to install SDK Platforms for API 15 and 23. Note that you don't need to install the SDK Platforms for API levels between the minimum and target (even if you are backporting to those API levels).
The list of Android API Levels can be found here:
https://source.android.com/setup/start/build-numbers
For a complete discussion on this you can visit:
https://docs.microsoft.com/en-us/xamarin/android/troubleshooting/questions/install-android-sdk-packages
Now, in a scenario where we are developing 5 apps with the following properties:
App #1
Target API 20.
Minimum API 16.
App #2
Target API 25.
Minimum API 16.
App #3
Target API 25.
Minimum API 19.
App #4
Target API 26.
Minimum API 21.
App #5
Target API 26.
Minimum API 26.
The SDK Platforms that we need to build those 5 apps 16, 19, 20, 21, 25 and 26
We confirm the installation.
Finally, we accept the agreement.
Now, the developer tools are installed and ready to go.
In the next entry, I'm going to describe how to export from Construct 2 and build using the Cordova CLI.