by Adobe
Adobe logo


2 May 2011


Create an Android package



<?xml version="1.0" encoding="utf-8" standalone="no"?> <application xmlns=""> (...) <name>Employees</name> (...) <icon> <image16x16>assets/appicon16x16.png</image16x16> <image32x32>assets/appicon32x32.png</image32x32> <image36x36>assets/appicon36x36.png</image36x36> <image48x48>assets/appicon48x48.png</image48x48> <image72x72>assets/appicon72x72.png</image72x72> <image114x114>assets/appicon114x114.png</image114x114> <image128x128>assets/appicon128x128.png</image128x128> </icon> </application>


In the previous tutorial, you learned to debug a Flex mobile application. In this tutorial, you learn to package your application for distribution. Currently, a mobile application can only be packaged for the Google Android platform.

Step 1: Make sure the project is set up to use your public server.

Make sure the server files are deployed on the public server and that the Flash Builder project server settings and the photo URLs reference your public server. Make sure the device is connected to the computer via the USB cable.
For specific details on this set up, see the earlier tutorial, Run on a device.

Step 2: Locate the debug package file.

In the Flash Builder Package Explorer, locate the APK file in the project's output folder (see Figure 1).
The first time you run or debug an application on a device, package files for the mobile project's target platforms are created. Currently, the only target platform is Google Android so an APK file, an Android Package file, is created. The application is then installed on the device via the USB cable.
Locate the debug APK file.
Figure 1. Locate the debug APK file.
When you are developing an application, a debug version of the application SWF is created and stored in the project's output folder. This SWF file includes additional code and metadata that the debugger uses. The APK file in this folder contains this SWF. When you are done debugging and ready to deploy, you need to create a release build of the application—a smaller, nondebug version of the SWF file and its corresponding APK file.

Step 3: Specify an application name and icon.

In the application descriptor file, set the name element to Employees and the icon element to the appropriate appicon.png files located in the assets folder.
Right-click FlexMobileTestDrive-app.xml and select Open With > Text Editor. Uncomment and modify the name and icon elements. Your code should appear as shown here:
<name>Employees</name> (...) <icon> <image16x16>assets/appicon16x16.png</image16x16> <image32x32>assets/appicon32x32.png</image32x32> <image36x36>assets/appicon36x36.png</image36x36> <image48x48>assets/appicon48x48.png</image48x48> <image72x72>assets/appicon72x72.png</image72x72> <image114x114>assets/appicon114x114.png</image114x114> <image128x128>assets/appicon128x128.png</image128x128> </icon>

Step 4: Create a release build.

Select Project > Export Release Build. In the Export Release Build wizard, select your FlexMobileTestDrive project and application, leave the Export to folder field blank (so the APK will be saved in the project folder), select Signed packages for each target platform (see Figure 2). Click Next.
Create a release build.
Figure 2. Create a release build.

Step 5: Specify a digital certificate.

If you already have a digital certificate, click the Browse button in the Export Release Build wizard (see Figure 3) and select the certificate file. Otherwise, click the Create button (see Figure 3) and in the Create Self-Signed Digital Certificate dialog box, enter your info, specify where to save the file, and click OK (see Figure 4). Click Finish (see Figure 5).
Choose to use an existing certificate or create a self-signed one.
Figure 3. Choose to use an existing certificate or create a self-signed one.
You cannot package and distribute the application without a digital signature. The digital signature has two main purposes: to provide significant assurance to your users that you are a trusted signer whose code will not do anything malicious to their computers and that the application they are installing has not been accidentally or maliciously altered since it was packaged. AIR code-signing certificates are sold by a number of companies, including ChosenSecurity, GlobalSign, Thawte, and Verisign; certificates are typically only sold to registered companies and the process includes submittal and verification of multiple company documents. Creating your own self-signed certificate (see Figure 4) is useful for developing applications.
If necessary, create a self-signed digital certificate.
Figure 4. If necessary, create a self-signed digital certificate.
Finish the export process.
Figure 5. Finish the export process.
The release version of the package file, the APK, is generated and the application is installed on any connected devices.

Step 6: Locate the release package file.

In the Flash Builder Package Explorer, locate the APK file (see Figure 6).
Locate the release APK file.
Figure 6. Locate the release APK file.
If you compare the sizes of the debug and release APK files, you will see the release APK is much smaller than the debug version.
You can now upload this APK to any application store like the Android Market. For info on uploading your application to the Android Market, see its developer documentation. An application created with the Flex 4.5 SDK requires Adobe AIR 2.6 or later to run. The required runtime version is specified in the application's application descriptor file (see Figure 7). If a device does not have the AIR runtime or the appropriate version of the runtime, the user will be prompted to download and install the AIR runtime the first time the application is launched on the device.
Locate the required AIR runtime version.
Figure 7. Locate the required AIR runtime version.

Step 7: View the new application name and icon.

Locate the application icon on the device (see Figure 8).
View the new application name and icon on the device.
Figure 8. View the new application name and icon on the device.
In this tutorial, you packaged your application for distribution. For further information on developing Flex mobile applications see the Mobile and Devices Developer Center.

Learn more

Refer to the following resources to learn more about this topic:
Documentation: Building Adobe AIR Applications
More resources