2 May 2011
Download the complete sample code (ZIP, 14.8 MB)
<?xml version="1.0" encoding="utf-8" standalone="no"?> <application xmlns="http://ns.adobe.com/air/application/2.6"> (...) <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.
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.
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.
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.
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>
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.
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).
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.
The release version of the package file, the APK, is generated and the application is installed on any connected devices.
In the Flash Builder Package Explorer, locate the APK file (see Figure 6).
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 application icon on the device (see Figure 8).
In this tutorial, you packaged your application for distribution. For further information on developing Flex mobile applications see the Mobile and Devices Developer Center.
Refer to the following resources to learn more about this topic:
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe.
|12/06/2011||Flex mobile resizeForSoftKeyboard leaving white space|
|07/01/2015||Logging in Android platform|
|07/01/2015||Invalid video codec for iPhone/iPod: SPARK in Wowza CupertinoPacketHandler|