Publishing your first android game using HaxeFlixel

So, you’ve built this amazing game in HaxeFlixel and now you want to publish it to the Google Play (or other) Store. What do you need to know?

Introduction

There are 3 main things you need to do:

  1. Change the package name from com.example to something else
  2. Get a new private key (specific for release builds)
  3. Modify your project.xml file to reflect the above

Let’s dig in and see how it’s done!

Package name

The first is to change the default java package from com.example.myapp to something else. If you don’t, you’ll get an error trying to submit to the Google Play store.

Open your Project.xml file (this should be in the root directory of your project) and find the following line:

<app title="HelloWorld" file="HelloWorld" main="Main" version="0.0.1" company="HaxeFlixel" />

And change the package name by adding the “Package” attribute to the xml tag. Like so:

<app title="HelloWorld" package="com.AwesomeCompanyName.SuperAppName" file="HelloWorld" main="Main" version="0.0.1" company="HaxeFlixel" />

Try to make that unique enough so you won’t interfere with other people.

Private key / certificate

By default, HaxeFlixel will package and sign your app in debug mode. Google Play does not like this, so you must generate your own key and create a release/production mode APK.

First, let’s generate a private key. You can reference android docs for this here. This is done with the Java JDK tool keytool.exe. Go in the bin directory of your JDK installation (mine is installed in C:\Program Files\Java\jdk1.6.0_37\bin) and run this tool with the following parameters:

keytool -genkey -v -keystore MyReleaseKeyForAwesomeApp.keystore
-alias PickAnAliasName -keyalg RSA -keysize 2048 -validity 10000

Follow the instructions from the app to generate the private key. This will be saved in whatever directory you ran the tool from.

Signing with your new private key

Now that you’ve generated your own private key, let’s use it in our app!

Go back to your Project.xml file and add the following line somewhere:

<certificate path="MyReleaseKeyForAwesomeApp.keystore" alias="PickAnAliasName" password="ThePasswordYouChose" if="android" ></certificate>

Now, make sure the private key is in the same directory as your project.xml file.

Fresh build

Now do the following:

lime build android -clean

This will do a fresh build with your new package name and your fresh and new release private key!

Images needed

When you submit, you will need 3 images – 2 screenshots of your app/game and 1 high res logo. Luckily, Google Play will warn you about that when you try to upload.

Uploading to Google Play

Now head to the publish area of Google Play, login with your developer account and click the big button that says, “Add new application.”

The rest should be straight forward, but let me know if you find any other snags!

Conclusion

I showed you what do do once you have a workable game/app in haxeflixel to get that in the Google Play store via the following:

  1. Changing the default package name from com.example to something more meaningful
  2. Changing the private key from the default debug key to your own release private key
  3. Updating your project.xml to use the new private key (and clean building after that!)


  4. Share this post


    facebooktwittergoogle_plusredditpinterestlinkedinmail

2 Responses to “Publishing your first android game using HaxeFlixel”

  1. Hope Tambala Says:

    Hi,
    So I’ve been developing in Haxeflixel for awhile (still an amateur for sure), but I’ve made a couple games for windows, mac, and linux targets.

    For the life of me, I can’t get an android target to work. the “lime setup android” command does “things,” but I don’t know where to go from there in relation to my game folder. I’ve scoured the internet and I have yet to find anything to really help me. Do you have like some sort of idea what I should do to get an android build of my flash game?

    Thanks!!

  2. Phillip Napieralski Says:

    Are you getting any errors? Have you tried creating a simple “hello world” android app with haxeflixel?

    You should be able to just “lime build android” after you do the setup. This will create an .apk file (do a ‘dir /s *apk’ in your working directory). With this, you can transfer and install it freely on android emulators and debug devices.