Releasing for Android with HaxeFlixel (Windows)
The process for releasing a HaxeFlixel game as an Android app is a bit complicated, so I thought I'd step through some of the steps. This is for Windows, but the process is largely the same for any platform.
- Register for a Google Play Developer Console account. The charge is currently $25.
- Prepare to compile by running
lime setup android. Make sure that your path to the Java JDK looks like
c:\java\jdk1.6.0_37and NOT to the
- Compile your app for Android. This can be done simply by running
lime build androidfrom the command line in your project directory. Make sure your input is set up properly, accounting for touch controls and the lack of mouse/keyboard! HaxeFlixel has some handy Haxe defines for this, e.g.
- Test your app on an Android device! You can set up the Android Debug Bridge (ADB) for this, but you could just email the APK to yourself. Slower, but easier.
- Provided everything works, you'll need to sign your app before you release it. So long as your
JAVA_HOMEenvironment variable points to the BIN directory (e.g.
c:/java/jdk1.6.0_37/bin/) you can do this by running
keytoolfrom the command line. Google recommends the following settings:
keytool -genkey -v -keystore YOUR_RELEASE_KEY.keystore -alias YOUR_ALIAS -keyalg RSA -keysize 2048 -validity 10000
It will ask for a password and stuff, which you will need to remember! Obviously, use your own values for
In order for Lime to see your certificate, you need to add it to the
Project.XML file. You can add this line:
<certificate path="YOUR_RELEASE_KEY.keystore" alias="YOUR_ALIAS" password="YOUR_PASSWORD" if="android" unless="debug"/>
Obviously use your own values where appropriate. Now when you run
lime build android it will sign the app automagically! Just look for
Finally, upload your APK! You can set up Google Play stuff too.
- If you have an SVG file set up as your icon in your
Project.XMLfile, Lime will make nice high-res icons for you. Do this! Just add
<icon path="assets/icon.svg"/>to your
Project.XMLfile. You can create SVGs using InkScape, or even by hand, as they are basically just XML files.
- Don't want to scare off potential customers with a bunch of app permissions? Lime includes a few by default, but this can be overridden. After building your app at least once, get
export/android/bin/bin/AndroidManifest.xmland copy it somewhere else (I usually put it into a
libsdirectory). Then, in your
<template path="libs/AndroidManifest.xml" rename="AndroidManifest.xml" if="android"/>
Now Lime will use this file instead of the default AndroidManifest it would normally generate. Inside this file you'll notice a few lines:
<uses-permission android:name="android.permission.WAKE_LOCK"/> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.VIBRATE"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
As far as I know you can delete these lines without issue. If you do this, when someone goes to launch your app, it will say "This app requires no special permissions". Obviously, this is not applicable if you actually need one of these permissions!
All of the code in this repository is available under an MIT license. Code not included in this repository (mostly just app settings, private keys, etc) is copyright SteveRichey but if you have questions about implementation let me know and I'll help you out!
- Pixel-perfect collisions.
- Special FX
Canabalt-themed flappy-like for FlappyJam.
The original version was programmed in ActionScript 3, and required flixel to compile.