Support for multiple mobile targets

When developing mobile applications for multiple platforms and devices, Flash Builder lets you specify different build configurations for each launch target.

For mobile projects, you can create a custom build target with specific package contents such as native extensions, certificate configurations, and different platform SDKs.

For more information on specifying project properties for a build target, see Project properties for packaged mobile projects.

Create a custom build target

  1. In the Package Explorer, select the project.

  2. Select Project > Properties from the main menu or select Properties from the context menu.

  3. In the Project Properties dialog box, select Flex Build Packaging, and select the target platform for which you want to view or change the settings.

  4. To create a custom target, click Create Custom, and specify details for the new target. Then, click Create. The target that you create appears in the list of available targets.

  5. Specify the digital certificate that you want to use to sign the mobile application, package contents, native extensions, and permissions and entitlements (if applicable).

  6. Click OK.

Select a custom target build in the launch configuration

When you specify a launch configuration to run or debug an application, Flash Builder picks up the applicable build target settings by default. For example, say that you created a build target "d1" to run the application on an iOS device. When you create a launch configuration to debug the application on a simulator, the target build is selected as "d1" by default. You can, however, change the default selection and select a different build target.

Export the application to a custom target

You can export a mobile application to supported custom targets besides the standard supported platforms.
Important: You can use the Export Release Build feature to launch a custom target only on a device.
When you select Project > Export Release Build, all the device-based targets configured for that project appear.

If there is more than one build target for a "device", the target names are displayed in platformname-targetname format. For example, if you have two build targets configured to launch the application on an iOS device, the target names are displayed as AppleiOS-targetname1 and AppleiOS-targetname2.The created application package name has the matching target name specified.

Example of packaging and exporting an application to multiple build targets

You are developing an application for the Apple iOS platform and you have multiple ActionScript Native Extension (ANE) files as follows:

  • Native extension "n1" for an iOS device (iPhone-ARM)

  • Native extension "n2" for the iOS simulator (iPhone-x86)

The native extension "n1" uses iOS4 SDK features and the native extension "n2" uses iOS5 SDK features.

While packaging your mobile application, you want to create different application packages for the device and simulator selecting different ANEs in each package, as follows:

  • Build target "d1" to launch the application on an iOS device with native extension "n1" selected

  • Build target "s1" to launch the application on the iOS simulator with native extension "n2" selected

To do so, follow these steps:
  1. In the Project Properties page, select Flex Build Packaging > Apple iOS.

  2. Click Create Custom to specify the first build configuration.

  3. Specify the Build Target Name as "d1", select the Build Target Base as "device", and click Create.

  4. Click Apply.

  5. Again, click Create Custom to specify the second build configuration.

  6. Specify the Build Target Name as "s1", select the Build Target Base as "simulator", and click Create.

  7. The custom targets that you created appear in the list of available targets.

  8. To select the required native extensions while exporting the application, follow these steps:

    • Select the target as d1 [device], and the native extension "n1" from the Native Extensions section. Click Apply.

    • Select the target as s1 [simulator], and the native extension "n2" from the Native Extensions section. Click Apply.

  9. Click OK.

You can export the application to multiple build targets by following these steps:

  1. Select Project > Export Release Build.

  2. In the Export Release Build dialog box, the custom targets that you created appear as "Apple iOS-d1" and "Apple iOS-s1". You can select multiple targets to export your application to.

  3. For each selected target platform, you can specify the native extension to use, the digital certificate to sign the application, and package contents.

    Note: The native extensions used in the project are included within the application package by default. You can, however, change the default selection if necessary. For more information, see Include ActionScript native extensions in an application package.
  4. Before exporting the application, you can add or edit the launch parameter values like -target, -keystore, and such. Click Customize Launch to customize the launch parameter values.

  5. Click Finish.