the blog
Back to -Blog

Android Development with Amethyst

Making Flash applications mobile
by Huw Collingbourne
Thursday 7 April 2011.

The latest (beta) release of Amethyst 1.3 includes preliminary support for mobile development on the Android, iOS and Blackberry platforms. Here I’ll guide you through the steps you need to take you create, deploy and debug your first mobile application from Visual Studio to the Android emulator.

Prerequisites and Installation

Before you are ready to start work on Android development there are certain tools and SDKs that you need to install.

- The Android SDK

First download the Android SDK for Windows (the .exe installer is recommended):

Run it to install the SDK.

- The Java JDK

If the Java JDK cannot be found the Android SDK installer will prompt you to download it. You may be prompted to download the Java SDK even if you already have it installed but it is not on the system path. If this is the case you need to add the JDK to the path.

To do that, open the Windows Control panel, open System and select Advanced System Settings. In the Settings dialog, click Environment Variables. Select PATH and click Edit. This is likely to show a long path in a small edit field. If necessary copy and paste the path into Notepad for editing. You need to make sure that \bin directory of the JDK is appended (after a semicolon) to the end of the path. On my system , I add this to the path:

C:\Program Files\Java\jdk1.6.0_05\bin

Click OK several times to accept all your changes and close down the dialogs. Now try again with the Android installation. A dialog should confirm that it has found your JDK.

- Create A Virtual Device

Carry on to the end of the Android SDK setup. At the end you will be prompted to install various packages. Accept the defaults and click Install.

When that’s complete you need to create a Virtual Device. select the ‘Virtual Devices’ option in the Android SDK and AVD Manager (which should already be running at this point but may also be load from the Start menu) . Click New. Enter a name such as Test and select a Target (e.g. Android 2.3.3 API level 10) the click Create AVD. Select the newly created device name and click Start and then Launch. It may take some time to start the Android emulator. When the emulator is ready it will display a start screen (with a background image and, usually, a little green android figure). If you see something else on the emulator, click its ‘Home’ button.


You also need to have the latest AIR SDK loaded (e.g. 2.6 or later). This is available here:

Once you’ve unzipped this (I’ll assume you’ve unzipped it to C:\AdobeAIRSDK), you need to install the runtime to your Android device or emulator. Here I am assuming you will be using the software emulator.

From the Windows Start menu, open a Command prompt (enter CMD) in the Start menu’s editable box. Change directory to the AIR Android emulator directory of the AIR SDK. e.g.

cd C:\AdobeAIRSDK\runtimes\air\android\emulator

Add the Android SDK Platform Tools directory to your path (this is a temporary change as you will do this only once). e.g.

set PATH=%PATH%;C:\Program Files\Android\android-sdk\platform-tools

Run the Android debug Bridge (ADB) tool to install Runtime.apk.


adb install -r Runtime.apk

After a few moment, you should see ‘Success’ displayed at the command prompt. If not, you must check that you have set the path correctly and you are in the emulator directory which contains Runtime.apk then try again. Once you are successful you can close the command prompt.

Create and Debug an Android app

Now you are ready to create, deploy and debug an Android application. For the sake of simplicity, mine will be a simple ‘Hello world’ program. Bear in mind that the instructions here relate to the preliminary release (the first public beta) of Amethyst’s mobile tools (April, 2011). These will change – in some areas, probably quite significantly – in later releases. We will aim to make deployment and debugging a much simpler experience. But for now, be sure to follow these instructions carefully.

First, if it is not already running, load the Android SDK Manager from the Start menu. Create or select a virtual device (as explained earlier) from the list and click Start and Launch.

Wait until the emulator is loaded and initialized.

Now let’s create a very simple “Hello World” application. For simplicity we’ll do this as an ActionScript mobile application (though Amethyst also supports Flex/AIR mobile applications).

Start a new Project: Select File, New, Project.

Select Mobile, Mobile ActionScript Application.

If necessary, browse to a location and name the project.

Click OK.

Open the main application file (the ActionScript file that is created automatically by Amethyst – for example, in my project this is and add this code to its constructor:

var textField:TextField = new TextField();  
textField.text = "Hello, World!";  

The TextField class needs to be imported. The simplest way to do this is to right-click TextField in the editor and select Organize Imports, Add Import.

This import statement will be automatically added:

import flash.text.TextField;

Place a breakpoint on the final line (stage.addChild(textField)).

NOTE: You must be using the Flex 4.5 SDK (or later). Make sure the SDK is set in the Application properties tab. Click the Browse button to select an SDK if necessary. Hint: You may add multiple SDKs globally using Tools, Options, Projects and Solutions, Amethyst. Click the Browse button next to Flex/default SDK Path and browse to add a new SDK.

Select Project, Properties.

Click the Application tab.

Make sure Project type is ‘AIR’ and Deployment is ‘Android’.

The project will be reloaded in order to apply these changes,.

Select Project, Properties.

Click the Deploy Tab.

Select Android

Browse to the Android SDK path (e.g. C:\Program Files\Android\android-sdk)

Make sure ‘Use emulator’ is checked.

Create a new key store or browse to use an existing one.

Note: A key store is required in order to allow an Android device to load your application.

To create a key store, click Create. Enter a name (e.g. ‘mykey’), a file name for the key store (e.g. ‘keyfile’) and a password (e.g. ‘mypassword’). Click OK.

If you see errors when creating a key store, check that you are using the Flex 4.5 SDK or later (set in the Application properties page) and try again.

The password you are using must be entered into the key store password field. This is done automatically.

Make sure that your Build Configuration is set to both Build and Deploy your application. Select Build, Configuration Manager. Alongside your Project’s name ensure that Build and Deploy are checked. Then click Close.

Also, make sure that the namespace in your xml configuration file is correct (you may receive a deployment error if it is not). This step is only likely to be needed while the Adobe AIR SDK is still in beta. Check this in the application tag of the xml file under the \config folder (in the Solution Explorer). For example, if you are using AIR 2.5 this should take this form:

<application xmlns="">

If you are using AIR 2.6 it should be like this:

<application xmlns="">

Your are now ready to build, deploy and debug your project. This can be done simply by pressing F5 (alternatively you may select each option in turn from the Build and Debug menus). The Android requires its daemon to be running. The first time you attempt to deploy, it may fail to synchronize in which case, just press F5 to try again.

The breakpoint will be hit and you can now use thee debugger.

Press F5 to continue and the program will display “Hello world!” on the Android emulator And you can now carry on debugging using the full range of debugging tools provided by the Amethyst ‘Cylon’ debugger. Here is a slightly more complex example: an Android-based adventure game being debugged in Amethyst...

Bookmark and Share   Keywords:  Amethyst  android  mobile  tutorial
© SapphireSteel Software 2014