Installing AIR and AIR applications on mobile devices

End users of your app can install the AIR runtime and AIR applications using the normal application and distribution mechanism for their device. On Android, for example, users can install applications from the Android Market. Or, if they have allowed the installation of apps from unknown sources in the Application settings, users can install an app by clicking a link on a web page, or by copying the application package to their device and opening it.

If a user attempts to install an app, but doesn’t have the AIR runtime installed yet, then they will be automatically directed to the Market where they can install the runtime.

While developing AIR applications, you can use ADT to install and uninstall both the runtime and your apps. (Your IDE may also integrate these commands so that you do not have to run ADT yourself.)

Install the AIR runtime and applications for development

You can install AIR runtime on a device or emulator using the AIR ADT utility. The SDK provided for the device must be installed. Use the following command:

adt -installRuntime -platform android -platformsdk path-to-android-sdk -device deviceID -package path-to-runtime

If the -package parameter is not specified, the runtime package appropriate to the device or emulator is chosen from those available in your installed AIR SDK.

To install an AIR application, use a similar command:

adt -installApp -platform android -platformsdk path-to-android-sdk -device deviceID -package path-to-app

If only a single device or emulator is attached and running, then you can omit the -device flag. If the AIR_ANDROID_SDK_HOME environment variable is set, then you can omit the -platformsdk flag. The value set for the -platform argument should match the device on which you are installing. Currently, the only supported value is android.

Note: Existing versions of the AIR runtime or the AIR application must be removed before reinstalling.

Running AIR applications on a device

You can launch installed AIR applications using the device user interface. You can also launch applications remotely using the AIR ADT utility:

adt -launchApp -platform android -platformsdk path-to-android-sdk -device deviceID -appid applicationID

The value of the -appid argument must be the AIR application ID of the AIR app to launch.

If only a single device or emulator is attached and running, then you can omit the -device flag. If the AIR_ANDROID_SDK_HOME environment variable is set, then you can omit the -platformsdk flag. The value set for the -platform argument should match the device on which you are installing. Currently, the only supported value is android.

Removing the AIR runtime and applications

In addition to the normal means for removing applications provided by the device operating system, you can use the AIR ADT utility to remove the AIR runtime and applications. To remove the runtime, use the following command:

adt -uninstallRuntime -platform android -platformsdk path-to-android-sdk -device deviceID

To uninstall an application use this command:

adt -uninstallApp -platform android -platformsdk path-to-android-sdk -device deviceID -appid applicationID

If only a single device or emulator is attached and running, then you can omit the -device flag. If the AIR_ANDROID_SDK_HOME environment variable is set, then you can omit the -platformsdk flag. The value set for the -platform argument should match the device on which you are installing. Currently, the only supported value is android.

Setting up an emulator

To run your AIR application on a device emulator, you must typically use the SDK for the device to create and run an emulator instance on your development computer. You can then install the emulator version of the AIR runtime and your AIR application on the emulator. Note that applications on an emulator typically run much slower than they do on an actual device.

Create an Android emulator

  1. Launch the Android SDK and AVD Manager application:

    • On Windows, run the SDK Setup.exe file, at the root of the Android SDK directory.

    • On Mac OS, run the android application, in the tools subdirectory of the Android SDK directory

  2. Select the Settings option and select the "Force https://" option.

  3. Select the Available Packages option. You should see a list of available Android SDKs.

  4. Select a compatible Android SDK (Android 2.2 or later) and click the Install Selected button.

  5. Select the Virtual Devices option and click the New button.

  6. Make the following settings:

    • A name for your virtual device

    • The target API, such as Android 2.2, API level 8

    • A size for the SD Card (such as 1024)

    • A skin (such as Default HVGA)

  7. Click the Create AVD button.

Note that Virtual Device creation may take some time depending on your system configuration.

Now you can launch the new Virtual Device.

  1. Select Virtual Device in the AVD Manager application. The virtual device you created above should be listed.

  2. Select the Virtual Device, and click the Start button.

  3. Click the Launch button on the next screen.

You should see an emulator window open on your desktop. This may take a few seconds. It may also take some time for the Android operating system to initialize. You can install applications packaged with the apk-debug and apk-emulator on an emulator. Applications packaged with the apk target do not work on an emulator.