Compile Phaser Games (or any other HTML5 Game) as Android Store App using Intel XDK

Intel XDK has long supported development and compilation of HTML5 games for Android, iOS and Windows store. It even provided a cloud based build system which took care of preparation of final packages which could be directly published to respective Android, iOS and Windows stores but starting from July 2017, Intel XDK build system has been shut down and new versions of Intel XDK do not have Game templates anymore. Still the tool is very useful for compiling your HTML5 games for Android, iOS and Windows stores.

We are going to look at steps to compile HTML5 game for Android in this tutorial.

Step 1 –

Download and install Intel XDK.

Step 2 –

Create a new project using Blank HTML5 + Cordova template.

Select “HTML5 + Cordova” and Click “Continue” which open a dialog box for specifying Project Name and Directory. We are going to use Dice Roller example code from previous article and compile it as Android app.

A project is created with default index.html

The default index.html code from the template looks like the following

Now were going to include game code in index.html file and remove the things we don’t want.

Copy the game files to the www folder except index.html (or whatever is your default game HTML file) which we will change manually by editing the index.html file created above.

We only added the game code to the index.html (as highlighted) and have not removed anything else yet for now. We can run this code in the simulator to make sure everything works fine. For that simply go to “Simulate” tab and select a device from list of simulators and then click on “Start Simulator” icon.

In order to create an APK we need to first export a build package from Intel XDK and then compile that build package using PhoneGap build or Cordova CLI. PhoneGap Build is similar to “now defunct” Intel XDK cloud based build system which does need any installation on developer system but is a paid service. There is one private app free with the service. For developers looking for more control over build process and no money can go for Cordova CLI build process which is quite straight-forward and can be easily managed.

The build process using Cordova CLI is summarized below. For further details refer to this link.

Prerequisites – Make sure you have Java SDK as well as Android SDK installed on your system.

Other Requirements –

  • Download and install Node.js (v6.11.0)
  • Open Node.js Command Prompt and install Cordova CLI 6.x by running command

Check if everything is setup on your system correctly by running following commands in sequence

If you see any error then run the following command to troubleshoot

This should display a message as following if everything is correct.

If not then you should see an error which should be resolved first.

If Node and CLI installation is done, we can start compiling our game for Android store. For this we need to export a build package of our game from Intel XDK which can be done by going to Build tab -> Select target platform (in our case Android) and then click “Create Package”

This will prompt you to save a zip file which is what we need for compiling our game to APK. Save zip file to some location and extract it to a folder.

Now in Node.js command prompt, go to the folder where ZIP file was extracted and then run following commands

This prepares a debug APK which can be found at  <Zip extract folder>/platforms/android/build/outputs/apk/android-debug.apk

Now we have a debug version of our game APK ready for testing. Once we are ready for a release version, we will need to prepare our APK with signing certificate.

First create a Android keystore using Intel XDK utility

Click “Save” and then download the keystore to your system. In order to create a release version run following commands in Node.js command prompt

 

 


2 thoughts on “Compile Phaser Games (or any other HTML5 Game) as Android Store App using Intel XDK

    1. I have faced issues when XDK loads initially. Sometimes it won’t open at all and requires a system reboot which is quite strange.

Leave A Comment

Your email address will not be published. Required fields are marked *