Use ADT to package an application that uses native extensions. You cannot package the application using Flash Professional CS5.5 or Flash Builder 4.5.1.
Details about using ADT are at AIR Developer Tool (ADT).
For example, the following ADT command creates a DMG file (a native installer file for Mac OS X) for an application that uses native extensions:
adt -package
-storetype pkcs12
-keystore myCert.pfx
-target native
myApp.dmg
application.xml
index.html resources
-extdir extensionsDir
The following command creates an APK package for an Android device:
adt -package
-target apk
-storetype pkcs12 -keystore ../codesign.p12
myApp.apk
myApp-app.xml
myApp.swf icons
-extdir extensionsDir
The following command creates an iOS package for an iPhone application:
adt -package
-target ipa-ad-hoc
-storetype pkcs12 -keystore ../AppleDistribution.p12
-provisioning-profile AppleDistribution.mobileprofile
myApp.ipa
myApp-app.xml
myApp.swf icons Default.png
-extdir extensionsDir
The following command creates an AIRN package, which is the package for AIR for TV applications that use extensions:
adt -package -storetype pkcs12 -keystore ../codesign.p12 -target airn myApp.airn myApp-app.xml myApp.swf icons -extdir extensionsDir
Note the following:
-
Use a native installer package type.
-
Specify the extension directory.
-
Make sure that the ANE file supports the application’s target device.
Use a native installer package type
The application package must be a native installer. You cannot create a cross-platform AIR package (a .air package) for an application that uses a native extension, because native extensions usually contain native code. However, typically a native extension supports multiple native platforms with the same ActionScript APIs. In these cases, you can use the same ANE file in different native installer packages.
The following table summarizes the value to use for the -target option of the ADT command:
Application’s target platform | -target |
---|
Mac OS X or Windows desktop devices | -target native -target bundle |
AIR for TV devices | -target airn |
Android | -target apk or other Android package targets. |
iOS | -target ipa-ad-hoc or other iOS package targets |
iOS Simulator | -target ipa-test-interpreter-simulator -target ipa-debug-interpreter-simulator |
Make sure that the ANE file supports the application’s target device
When providing an ANE file, the native extension developer informs you which platforms the extension supports. You can also use an archive extractor tool to look at the contents of the ANE file. The extracted files include a directory for each supported platform.
Knowing which platforms the extension supports is important when packaging the application that uses the ANE file. Consider the following rules:
-
To create an Android application package, the ANE file must include the Android-ARM platform. Alternatively, the ANE file must include the default platform and at least one other platform.
-
To create an iOS application package, the ANE file must include the iPhone-ARM platform. Alternatively, the ANE file must include the default platform and at least one other platform.
-
To create an iOS Simulator application package, the ANE file must include the iPhone-x86 platform.
-
To create a Mac OS X application package, the ANE file must include the MacOS-x86 platform. Alternatively, the ANE file must include the default platform and at least one other platform.
-
To create a Windows application package, the ANE file must include the Windows-x86 platform. Alternatively, the ANE file must include the default platform and at least one other platform.
Note: AIR for TV devices use device-bundled extensions. The native libraries for extension are installed on the device. AIR for TV uses those libraries when the application runs on the device. However, the ANE file for an AIR for TV extension includes the
default platform and an ActionScript-only implementation. Creating an AIR for TV application (AIRN file) is the only case in which the ANE file can have
only the default platform.