Since July 2010 I’ve been playing with Adobe AIR for Android. I got the prerelease version of the runtime and started investigating the new APIs for mobile devices. Adobe AIR hit the Android Market on 9th October 2010, so it’s time for the AIR developers to get to work. There are few things that if found difficult at the begining, especially the configuration and building the Android APK archive.

Setup your development environment

Here’s how I setup my Adobe AIR for Android environment (both MacOS X and Windows)

Setup – Adobe AIR / Flex part

FLEX_DIR (MacOs) = /Users/piotr/SDK/flex_sdk_4.1_air_2.5
FLEX_DIR (Windows) = C:\SDK\flex_sdk_4.1_air_2.5

1. Download Flex SDK (version 3.5 and newer – I used 4.1) and put it in directory FLEX_DIR

2. Get the Adobe AIR 2.5 SDK – it’s a zip file like Flex SDK 3. Extract AIR 2.5 SDK and copy all the files to FLEX_DIR – overwrite all the files in FLEX_DIR that might overlap 4. In FLEX_DIR you now have the Flex SDK combined with AIR 2.5

Setup – Android part

ANDROID_DIR (MacOs) = /Users/piotr/SDK/android
ANDROID_DIR (Windows) = C:\SDK\android

3. Download Android SDK and put it in ANDROID_DIR

4. Get Android 2.2 libraries and emulator using “Android SDK and AVD manager”
– goto ANDROID_DIR\tools
– run android (Windows) or ./android (MacOs X)

5. Create an virtual device (for emulator) with Android 2.2 system (if you don’t have an Android 2.2 device)

You could add the FLEX_SDK\bin and ANDROID_SDK\tools directories to your system’s PATH variables to make the development process faster, but I’m not going to cover this topic here.
I will keep it simple to illustrate the whole process.

6. To be able to test you application you need to install Adobe AIR runtime for Android.
The AIR prerelease comes with two versions of the runtime – one for the device and one for the emulator.

The runtime for the device is Runtime_Device_Froyo_20100930.apk

The runtime for the emulator is Runtime_Emulator_Froyo_20100930.apk

Creating Android 2.2 virtual device for emulator

I created an Android 2.2 emulator (virtual device) with name “Android_22″ and the install process looks like this:

I’ll use the ANDROID_EMULATOR_NAME for “Android_22″ – my virtual device name. If you created a virtual device with a different name, then it would be the device’s name.

First, you need to make sure that the emulator is up and running.
Goto ANDROID_SDK\tools by typing: cd ANDROID_SDK\tools
Run the emulator:

(MacOS) ./emulator -avd ANDROID_EMULATOR_NAME or ./emulator @ANDROID_EMULATOR_NAME

(Windows) emulator -avd ANDROID_EMULATOR_NAME or emulator @ANDROID_EMULATOR_NAME

Potential problems

If you get the “device not found” message you might need to restart the adb service.
I had that problem but it worked after running these commands:

adb kill-server
adb start-server

After the adb has restarted give the runtime install another try, it should work.

You rock

If you see “Adobe AIR” under Settings -> Applications -> Manage Applications than congratulations – you are ready to develop AIR apps for Android.