Thursday, November 04, 2010

AIR for Android Tutorial (Part 2)

In the first AIR for Android tutorial, we showed just how to get started.  This tutorial is a complete video along with the source code.  This blog post includes the necessary instructions for building your first application and then adding a transform gesture.  With many smartphones using touch screens, the desired behavior is to allow an application to scale upwards but never scale below a certain minimum size.  This tutorial and the accompanying source code or Flash Builder 4.1 project explain how to accomplish this task.

Untitled from Technoracle on Vimeo.

Source Code: (download)

Wednesday, November 03, 2010

AIR for Android Tutorial

I've been developing a few AIR applications using AIR 2.5 and packaging them up as *.apk's for Android O/S.  The steps are relatively easy. You must have the following items to complete this tutorial:
  1. An unlocked and tethered Google Android device with Android 2.2 or later installed;
  2. Flash Builder 4.1;
  3. The Adobe AIR 2.5 SDK;
  4. The Google Android SDK;
First you need to get Flash Builder 4.1 and overlay the AIR 2.5 SDK.  Copy the AIR 2.5 from the Adobe Labs site to your desktop.

Copy the AIR SDK to the directory where you installed Flash Builder /sdks/.
Before unpackaging the AIR SDK to that directory, make a copy of the sdk you will overlay the AIR SDK on to.
With a terminal window, navigate to the directory /sdks/ and type:

       tar -jxvf AIR25_mac_sdk_XXXXXX.tbz2

This should unpackage the *.tar file and overlay your SDK. 

2. Building your AIR application

1.     Start a new project in Flash Builder with the following parameters:

Application Type: AIR
SDK: 4.1 (use the SDK you wrote AIR 2.5 into above)

2.     Change the root element from <s:WindowedApplication> to <s:Application>.

3.     Open the application descriptor file and navigate to lines 154 and175. Uncomment the entire android manifest section.

4.     Navigate to line 96 and uncomment, make “mobileDevice”.

5.     Save the descriptor and close it.

3. Packaging and putting your app onto your device

1.     Open a terminal and navigate to

         For example:

     cd /Users/duane/Desktop/Android/AIR25_mac_sdk_20100930/bin

2.     Using finder, copy the SWF and the app descriptor from the Flash Builder /bin-debug folder of your workspace over to the SDK.  (N.B. SDK must be the same version!)

3.     In the terminal, type in the following.  You will need a PKCS12 certificate set up to do this and modify the path to point at your certificate.  The next parameter is the name of the output *.apk (in this example "Android-REST.apk") following by parameters of the XML descriptor and the main swf file.

./adt -package -target apk -storetype pkcs12 -keystore ../../certificates/Sharkswithlaserbeamsinc.p12 Android-REST.apk ./Main-app.xml ./Main.swf

4.     In your terminal, CD to /android-sdk-mac_86/tools.  Test the device connection by running the ADB devices command:

./adb devices

5. Install your application by typing ./adb install -r ../../AIR25_mac_sdk_20100930/bin/Main.apk
Substitute the path to the newly created *.apk.
Launch the app on Android.  It should run as any other app but the name of the original *.mxml file will be the name of the app.

Monday, November 01, 2010

Flash and the City 2!

I have just received word that I'll be back to next year's Flash and the City event in New York. Event organizers have found a larger venue for the event and have expanded the length to include some half day workshops. The goal is to repeat the MAX AIR 2 Code Camp in one of these time slots. This is a course that ended up being ranked very well including a score of 4.96/5 with 70 evaluations.

See you at FATC2011!