Wednesday, 21 April 2010

Airplay SDK - building C++ apps as Android .apk files - first impressions

I noticed the other day that the Airplay SDK now uses modern C++ with STL - nice, and essential for my code. I already knew that the Airplay SDK supported Android, and having taking a look at my Android porting options I really didn't want to directly port my own C++ app code to Android using STL and JNI - there would be too much pain involved. :-0

So, having just installed the latest Android SDK on Windows 7 and Mac, I figured it was time - finally - to download and install the Airplay SDK evaluation.

In installed the Windows version on my Mac under Boot camp. This requires Visual Studio 2008 (the Express edition should work, if you're interested...).

Installation on Windows was easy, the eval license registered properly and I was soon following the instructions to build my first basic demo project. [I actually started with the Mac version - still in Beta - but it failed to register my eval license! Serves me right for starting with Beta software :)]

I double-clicked the example project file for a 3d demo game, which automatically constructed and opened a suitably configured Visual Studio project. Building this for the x86 target was as easy as building any other Visual Studio project - very simple.

Running-up the project under Visual Studio debugger for Windows, ran the app through a device emulator, which worked smoothly.

I next trivially rebuilt the app for ARM Debug target, ran under Visual Studio under ARM emulator on Windows - again this was easy and worked fine - it runs the app through an arm device Emulator, with a graphical version of GDB as the debugger.

Having rebuilt the app for ARM Release target, I next used a simple utility that comes with the Airplay SDK, to bundle-up the app an a .apk file (the installer format for Android). This was really easy. Note, however, that I first had to rename the Android SDK 1.6 folder on my PC (see the Airplay SDK forum for details on how/why!), and had to install a couple of other tools that are clearly documented in the Airplay documentation). Anyways: once your system is configured, building the .apk file is very easy. :)

I next installed the .apk to the Android SDK's emulator using the "adb install" command, and ran-up the application directly from Android SDK emulator. This worked OK, albeit with a slow frame rate I've been told that on devices the frame rate is very, very much faster than the emulator).

So, a really good experience so far. I'm looking forward to finding out more in due course. I was impressed enough to get a 99 dollar "indie" license; the "iPhone" license is actually free, which is very cool.

I'll need to find out how well it all works on a real Android device, and try some complex 2D graphics and heavy-duty audio, but the Airplay SDK so far looks very promising. It is powerful enough that it even looks like it'd be relatively straightforward to port frameworks like Qt to the Airplay SDK.

I found the online documentation to be a pain to navigate, but the documentation in Windows CHM file format (in the SDK) is pretty good.

The bottom line for me is how easy it was to get from generic C++ code, to a .apk file for Android - very impressive indeed. Not only that, the SDK supports buildling Symbian .sis files, Window Mobile .cab files ... and various other platforms. Plenty here to keep me busy and productive!

Edit: I've just discovered that Airplay doesn't support threads at the moment... which is problematic, to say the least!

Edit: I've heard via the Airplay forums that Thread support is coming in a few months ... which is very good news. :) Meanwhile, the port of Mixtikl to Android/Symbian via Airplay (and also a port of Mixtikl via Qt...) is coming along well, so maybe we'll have something to report in a few weeks...


Dom said...

I'm impatient to see the first result...

Pete Cole said...

So am I. :)

elanrth said...

Pete , Can you share your latest review\comments on AirPlay SDK specially about performance..? I am sure you must have finished your apps on AirPlay SDK..

Suresh Nariya.

Pete Cole said...

Hi Suresh,

Performance has been OK; however, the big problem for us remains the lack of Multi-threading in Airplay.

Withouth Multi-threading, the app remains too "clunky" to release. We're therefore waiting for Airplay to support Multithreading ... and stereo audio output on Android. :)

I've recently started working through a background process of performing a direct native port, using the Crystax NDK (which supports JNI with Exceptions, STL and RTTI!), which hasn't been too hard really. I'll probably have that completed before Airplay supports Multithreading; at which point it will be interesting to compare performance. :)

The other issue for us with Airplay is that it doesn't seem to allow any embedding of the UI in another context, which of course is essential for any in-app advertising or an in-app store.

The use of an advertising an/or an in-app store is very, very important for commercial models in the mobile app space; take a look at the new release of Mixtikl on the Apple App Store to see what a good implementation we've been able to put in our native iPhone version of Mixtikl. Our users seem to be really happy with it!

Best wishes,


Clubs said...

Hi Pete

Have you any updates on Airplay, have you tried the new 4.4 beta with the EDK?

How did you end-up handling the threading issue?


Pete Cole said...

Hi Clubs,

We ended-up shelving the Airplay port, performance was pretty poor due to the multi-threading issue.

I went quite a long way down the road of porting my own 2D framework to Android, using NDK ... when I found that the author of Juce was interested in porting Juce to Android!

I'm now very optimistic that Juce will be fully ported to Android, and that will open so many doors for a lot of people to get their C++ apps easily on to Android - including me!