Word Up Dog: Creating Android apps with Adobe Air

A screenshot of Word Up Dog the game
Word Up Dog: represent, yo!

Having already optimized my game Word Up Dog so that it runs relatively well in a browser on an Android phone, I was ready to package it up as an installable app. Adobe Air makes this easy to do with few changes to your original code. Adobe has a Flash CS5 plugin to do it, but I prefer to do things the free-and-open way when I can, so here’s how I built the Android app using only FlashDevelop and other free Windows tools.

First, I don’t recommend the Android emulator. I struggled with getting emulator-compatible versions of the Air packager and Air runtimes installed. There didn’t seem to be much advantage so use a phone if you can get your hands on one.

I followed several tutorials and honed the process down to this:

  1. Download the Air 2.5 SDK, paste it into a copy of your Flex SDK directory, and set FlashDevelop to compile using the result
  2. Start a new FlashDevelop AIR AS3 project
  3. AddChild your existing game in Main.as
  4. Add NativeApplication handlers to prevent the phone from idling
  5. Add android-specific settings to application.xml (here, have mine)
  6. Generate a certificate using
    adt -certificate -cn WordUpDog 1024-RSA certificate.pfx yourpass
  7. Build your air project to create WordUpDog.swf
  8. Package the swf into an apk file with
    adt -package -target apk -storetype pkcs12 -keystore certificate.pfx -storepass yourpass WordUpDog.apk application.xml -C . WordUpDog.swf iconsFolder
  9. Upload WordUpDog.apk to your phone and baby, you’ve got a stew going
Word Up Dog on a Nexus One
Victory - the Air for Android app is installed!

I was prompted to install the Air interpreter the first time I ran the game on my Nexus One, then it behaved just like any other app. The performance was about the same as running the SWF through the phone’s browser, but of course there are advantages to being installed. I could force the game to stay in landscape perspective and add a customized handler to deal with incoming phone calls. Not to mention being able to upload and sell it on the Android app store!

Next I’ll tackle Air on the iPhone.

Share

3 thoughts on “Word Up Dog: Creating Android apps with Adobe Air

Leave a Reply

Your email address will not be published.