If you own an Android 2.2 (Froyo) device you must know that you can already start building (and testing!) your AIR 2.5 applications for Android. There’s more: if you are an FDT user like me you should be glad to know that is very easy to build and package our AIR4Android applications without even leaving our favorite tool!
Let’s start
I’m not going deep into how to setup your Eclipse environment with FDT as I assume you already have some sort of confidence with both of them. Let’s say you have a working copy of Eclipse and just installed FDT professional (or whatever version you like). Once you have these programs installed we can take care of SDKs.
SDKs
Go to Android developer portal and download & install latest Android SDK for your platform. You can simply follow default installation instructions for this. In the same way download Flex 4.1 SDK and extract all content in a specific folder of your hard disk. At this point you just need to merge Flex SDK with AIR 2.5 SDK. The AIR 2.5 download is restricted to the Android Prerelease program members, you can sign up here. Finally configure FDT’s preferences to use the new Flex SDK location.
Please, refer to the official documentation to know how to setup your Android virtual devices and emulator if you want to debug your applications on the SDK emulator first… We will focus just on compiling the apk (Android installable) file we need to test the application on a real device.
The project
The project will be a simple, standard AIR project. The basic structure includes the app-xml descriptor, the main class file and icons we need for our application. Be sure to change your application descriptor namespace to include “2.5″:
and the “initialWindow” visible flag is set to true:
...
<visible>true</visible>
...
</initialWindow>
Now we have our project ready to be compiled and packaged. This should be the most boring part but I was able to quickly adapt a great ANT file shared from Jonathan Campos in a recent post.
Basically it consist in a total of three files; base.properties, build.properties and build.xml. The first two are just storing all path variables we’ll need to compile (SDKs, source files, assets location etc…), while build.xml takes care of compiling the swf, create a proper certificate, package the apk file for us and install on device too!
You just need to change build.properties to fit your setup:
FLEX_HOME=/Users/Shared/flex_sdk_4.1.0.16076
SDK_VERSION=4.1.0.16076
#Android SDK Folder on your computer
ANDROID_SDK=/usr/tools/android-sdk-mac_86
#App Settings
APP_NAME=MyFirstAndroid
#compiler flags
LOCALE=en_US
DEBUG_FLAG=false
#Certificate
CERT_PASSWORD=yourPass
CERT_NAME=CertName
CERT_ORG_UNIT=Software Development
CERT_ORG_NAME=OrgName
STORETYPE=pkcs12
KEYSTORE=cert.p12
CERT_COUNTRY=IT
CERT_KEY_TYPE=2048-RSA
That’s all! You can either run ANT file from command line of from Eclipse. Below you can see a picture showing how your project should look like:

Download and test!
I know, it’s a little boring to set up all this stuff before actually starting coding the good things. To solve this problem I uploaded a template project on google code for you to check out and use as base code for your next AIR Android killer app, enjoy:
https://code.google.com/p/air-on-android-with-fdt/
Feel free to send me your comments and suggestions!
Related Links:
http://www.fdt.powerflasher.com/ (FDT)
http://www.eclipse.org/downloads/ (Eclipse)
http://developer.android.com/sdk/index.html (Android SDK)
http://labs.adobe.com/technologies/air2/android/ (Android prerelease program
http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4 (Flex 4.1 SDK)
http://unitedmindset.com/jonbcampos/2010/07/19/android-mobile-development/ (Original ant file)
If you enjoyed this article, you might also like...
2 Comments to “How to build your first AIR4Android application using FDT and Eclipse”
Post comment
About MobileRevamp
The aim of this community is to share as much as possible information related to the mobile development using all the social networks and the new capabilities of the NET to make easier find updated contents and to create a deep feeling of connection between developers.
Updates
Archives
Recent Comments
- Giorgio Natili on Mobile Flash player 10.1 OR AIR 2.6 on Android?
- Patric on Mobile Flash player 10.1 OR AIR 2.6 on Android?
- AIR4Android on How to build your first AIR4Android application using FDT and Eclipse
- Tonsula on How to build your first AIR4Android application using FDT and Eclipse
- jbozabalian on Cross plarform mobile development
Adobe Mobile UGs
- Adobe Groups
- Australia MaDUG
- Boston MaDUG
- Brazil MaDUG
- Copenhagen MaDUG
- Dallas MaDUG
- India MaDUG
- Polish MaDUG
- Spain MaDUG
- UK MaDUG
Authors

















Tonsula says:
Ciao Leonardo,
explain me… what’s the point of developing on Android with Air when you can develop in Java directly and it is MUCH but MUCH CLEANER?
Btw you can also do this developing in Air and packing your swf then calling the swf from java.
AIR4Android says:
Flash Builder Burrito makes it even more easier to develop AIR apps for Android:
http://blog.air4android.com/?p=13