Your own Android application!

This article will help you developing your first Android application based on Adobe AIR.

All tools are free of charge available. This article is assuming you use (Ubuntu) Linux.

Prepare your development environment

First download the software development kits (SDKs):

Unpack these SDKs in the directory:

Add the directories of the SDKs which contains the executables to the environment variable: PATH by executing this command:

Creating your application

Now it’s time to create a HelloWorld-application.

  • Create project directory:

    and step into that directory:
  • Create subdirectory: assets
  • Create subdirectory: assets/img
  • Create 3 PNG-images (36×36 pixels, 48×48 pixels and 72×72 pixels) representing the icons of the application.
    Place these 3 files in the directory: assets/img

Create the file HelloWorld.mxml containing these contents:

Now execute

to compile the HelloWorld.swf file. amxmlc = Adobe Air MXML Compiler.

Create your self-signed certificate by executing the command:

Now create the file application.xml which describes your Adobe AIR application:

As example the Adobe AIR application asks permission to obtain location information (android.permission.ACCESS_FINE_LOCATION) and use the Internet connection (android.permission.INTERNET). In this HelloWorld-example the AIR application is not actually using one of both.

Hint: You can test the application by executing the AIR Debug Launcher (ADL) :

Next step is to package your application to an APK-file using the AIR Developer Tool (adt). Use this command to create an Android package which you can install at your Android emulator:

Use the full path to ‘adt’ in the Adobe AIR SDK. The ‘adt’ supplied in the current Flex SDK is not capable to package the apk-emulator target.

Testing the application

Now it is time to run our HelloWorld application. But first we have to set up our emulator environment.

Preparing the Android emulator

  • Start the Android SDK and AVD Manager by executing the command:
  • Click: ‘Available Packages’ in the left frame.
  • Now select ‘SDK Platform Android 2.2, API 8 revision 2.
  • Click ‘Install Selected’, ‘Accept all’ and ‘Install’.
  • A download will start. Take a coffee.

Create a new Virtual Device using the Android SDK and AVD Manager.

  • After installing, click in the left frame: ‘Virtual Devices’.
  • Click at the right side the button: ‘New…’.
  • Type the name for the new emulator i.e.: ‘Android Emulator’.
  • Select Target: ‘Android 2.2 – API Level 8’
  • Type as size: 100 MiB
  • Keep the other settings unchanged.
  • Click: ‘Create AVD’. AVD = Android Virtual Device
  • Quit the ‘Android SDK and AVD Manager’
  • Start your fresh emulator the first time by executing the command:
  • Wait while the emulator boots up Android.

Install the Adobe AIR runtime on the emulator

When you see the home screen of Android in the emulator, you can install the Adobe AIR runtime at the emulator using the Android Debugger (adb).

Execute this command:

Hint: -e means connect to the only running emulator at this machine.


Install your HelloWorld application

Finally you can install the APK containing your HelloWorld application at the Android emulator.

We assume you are still in the ‘helloworld’-project directory which contains the HelloWorld.apk file and the emulator must be running.

Execute this command:

Hint: Next time use:

(reinstall application)

Now click in the emulator the button with a matrix of small squares on the surface. You will enter the screen displaying the icons of the installed applications. One of the icons is the one created by you. Below this icon ‘HelloWorld’ is displayed: Click this icon.

Wait while loading and starting your application.

See your application in action!

Further reading

One thought on “Your own Android application!”