This document describes the step-by-step instructions for building a Haxe* project (OpenFL*) for Intel® x86 for the Android* platform.
Haxe is an open source programming language. While most other languages are bound to their own platform (Java* to the JVM, C# to .Net,
ActionScript to the Flash* Player), Haxe is a multiplatform language.
You can use Haxe to target the following platforms:
- Flash. You can compile a Haxe program to a .swf file. Haxe is compatible with Flash Player 6 to 11. Haxe offers good performance and language features to develop Flash content.
- NekoVM*. You can compile a Haxe program to NekoVM bytecode. This can be used for server-sideprogramming, such as dynamic webpages (using mod_neko for Apache), and also for command-line or desktop applications, since NekoVM can be embedded and extended with some other DLL.
- PHP. You can compile a Haxe program to .php files. This enables you to use a high-level strictly typed language such as Haxe while keeping full compatibility with your existing server platform and libraries.
- C++. You can generate C++ code from your Haxe source code, with the required Makefiles, a useful capability for creating native applications. The NME library uses this to run Haxe code on iOS*, the Android* platform, and so on. As of 2.10 it also includes debugging.
- C# and Java. You can generate source code for these targets as of Haxe 3.0.
The idea behind Haxe is to let the developer choose the best platform for a given job.
Setup and Prerequisites
Before starting, you’ll need to download and install the following:
1. Download the Android SDK
2. Download NDK.
3. Download and install Cygwin*: When asked to select packages, search for the following packages and install them:
1. Autoconf, Automake, binutils, gcc-core, gcc-g++, gcc4-core, gcc4-g++, gdb, pcre, pcre-devel
2. gawk, make, python
Note: Select the GUI version of make as well; otherwise, you will not be able to build your project using NDK.
4. Download the Java Development Kit (JDK).
5. Download Apache Ant*.
Next, edit the environmental variables.
1. Set JAVA_HOME = the path in which you have installed the Java JDK. For example:
2. Set ANDROID_SDK_ROOT = the complete path to the SDK folder. For example: Download and extract the ADT bundle in
D:\android\, so my path is: D:\android\adt-bundle-windows-x86-20131030\sdk
3. Set NDK_ROOT = the complete path to the NDK folder. For example:
4. Set NDK_ROOT = the complete path to the NDK folder. For example:
5. Update the Path variable to contain the following = path to the JDK folder, JDK bin folder, NDK, Cygwin bin folder, ANT bin folder, SDK tools folder, and SDK platform-tools folder, each separated by a semi-colon (;). For example:
NOTE: Do not end any variable with “\” , “`”, or any such special character.
Getting the HAXE and Corresponding Libraries
You can get the Haxe from sources using the instructions at https://github.com/HaxeFoundation/haxe or download the prebuilt source from https://haxe.org/download.
Here are the steps for downloading HAXE and corresponding libraries:
1. Download HAXE from prebuilt sources from https://haxe.org/download. Choose the windows installer.
2. Double-click the installer after download, and then follow the installation steps.
3. The installer sets the environment variable HAXEPATH and appends to the system PATH environment variable. If not, please do what’s necessary. For example: Create a env HAXEPATH to the installed path such as E:\HaxeToolkit\haxe\ and then add the path to the system PATH env.
4. The automatic installer will install NekoVM, which is used for some Haxe tools such as haxelib andhaxedoc. If you are building from sources, please download and install neko fromhttps://nekovm.org/download.
Note: set NEKO_INSTPATH to the Neko. For example, E:\neko-2.0.0-win\ and add NEKO path to system PATH env.
5. Install the required libraries that are part of OpenFL using the following:
Note: haxelib is part of haxe and resides in the HAXEPATH.
1. haxelib install openfl
2. haxelib install hxcpp
3. haxelib install hxlibc
4. haxelib install openfl setup android
Note: You can install through haxelib, or you can skip this step by giving local installation directories for Android SDK, NDK, and Ant, as shown in the following screenshot.
6. Now that the libraries are installed, you can build the procedure. You can check the installed libraries by typing the following commands:
For example, your screen will look like the following when you type haxe:
Creating a Sample Application (OpenFL)
A sample OpenFL application can be created using the following command:
>haxelib run openfl create DisplayingABitmap
The above command creates a sample project.
Building the Application for x86 for Android
The following command should be used for building/cleaning the haxe OpenFL application for x86 for Android:
>haxelib run openfl build android –DHXCPP_X86 –verbose
>haxelib run openfl clean android –DHXCPP_X86 –verbose
Configuring Haxe OpenFL for x86 for Android
The following files can bring in or add the x86 configuration settings for Android:
openfl-native/1,1,1/project/Build.xml to get -x86 suffix
Output or Binaries
The final binary generates to
The libraries generate to
Known Issues or Additional Info
- Installation of a package fails. For example: haxelib install openfl fails saying
- “Error Connect/Blocking”
- Solution: Make sure the proxy settings are set if you are using a proxy for the Internet; for example: haxelib proxy
- openfl build android fails saying:
- ANT/...build.xml , target 16/XX not found
- Solution: Add the following in the project.xml for the OpenFL project: <android target-sdk-version="19" /> // where 19 is one of the available SDKs.
For more such intel resources and tools from Intel on Game, please visit the Intel® Game Developer Zone
Other Popular Deals
- The 10 best job hunting apps on AndroidTop 10 Android launchers (June 2017)
- The 10 scariest horror games on AndroidAndroid app stores: 5 best alternatives to Google Play Store
- Best Android apps for rooted devices18 apps for a memorable Valentine's Day
- Top 15 Android games that you should playThe 20 best looking games for mobile phones
- 8 Android apps to tickle your funny bone17 must have apps for any Android device (plus alternatives)
- 5 apps to get the Android Lollipop look on your smartphoneTake control of your Android device with these apps
- 7 weird and strange apps for your Smartphone10 neat Google apps you may not know of
- Perfect Viewer10 essential Indian apps for Android devices