Tutorial Basic setup to deploy HTML5 games on Android [+Cordova]

U

User_920791

Guest
Guest
Due to the huge variety of html5 engines and the technical differences that may exist in each type of project, this guide will focus only on the basics needed to create an android version of an html5 game. Other customization aspects will also not be covered here.

The information contained here is intended for Windows users, but can also be applied to other platforms with some adaptations.

1. Install .


2. Install .


3. Install .


4. Open Android SDK Manager ("SDK Manager.exe" which is inside the folder where you installed the Android SDK), update the "Android SDK Tools" component and install the "Android SDK Platform-tools" and "Android SDK Build-tools" components that appear in the Tools section. Then install the components "SDK Platform" and "Sources for Android SDK" inside the sections "Android 8.1.0 (API 27)" and "Android 7.1.1 (API 25)"


5. Download and . Unzip them in C:\ .


6. Create the following environment variables:
Code:
name: ANDROID_HOME
value: "Insert Android SDK path"
Code:
name: ANT_HOME
value: "Insert Ant path"
Code:
name: GRADLE_HOME
value: "Insert Gradle path"
And add the following content to the PATH variable:
Code:
%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools;%ANT_HOME%\bin;%GRADLE_HOME%\bin;
If you have questions about how to do this, .


7. Open Node.js command prompt (C:\Windows\System32\cmd.exe /k "C:\Program Files\nodejs\nodevars.bat") And run the following commands:

Code:
npm install –g cordova
Code:
cd \
Code:
mkdir html5games
Code:
cd html5games
Code:
cordova create gamename random.gamename gamename
Code:
cd gamename
Code:
cordova platforms add android

8. Keep Node.js command prompt open and copy the contents of your game (index.html etc) to C:\html5games\gamename\www .


9. Run the following command on Node.js command prompt:

Code:
cordova build android

After a few minutes, the apk file can be found at C:\html5games\gamename\platforms\android\app\build\outputs\apk\debug .