This post will show you how to package an AIR Native Extension (ANE) on the command line.
The bad news first: it’s a nuisance – a lot of file copying, renaming and deleting before you even get to run any command-line tools. Now the good news: all of this can be automated with a script – see the note at the end of this article.
Before you put the automated scripts to use, however, it’s good to see what they actually do. Let’s get started.
- 1 well-built AIR library in the form of a SWC
- 1 library.swf file, extracted from the SWC
- 1 extension descriptor – your-extension.xml
- depending on your platform: 1 platform options descriptor – your-ios-platformoptions.xml, if packaging for iOS
- 1 well-built native library in the form of an .A, a .JAR or a .DLL file
- around 10 minutes for manual packaging
- up to a minute if using scripts – scroll to the bottom of the post for more information
As many as you dare serve your ANE to.
1. Gather the ingredients:
1.a. Make a copy of your AIR library’s SWC file and rename its extension to .ZIP:
1.b. Unzip the .ZIP copy you just created. This will result in a folder with two files in it: catalog.xml and library.swf:
1.c. Keep your original .SWF file and library.swf and delete the .ZIP file and catalog.xml:
1.d. Create a folder in which you’ll package your ANE and copy the following files to it:
- your original AIR library’s .SWF file
- library.swf, which you extracted from the .ZIP archive
- your extension descriptor
- your platform options descriptor, if you’re packaging an iOS ANE
- your native library – an .A, .JAR or .DLL file
2. Open a Terminal (Mac OS) or a Command Line (Windows) window and run Adobe’s ADT tool:
You’ll need different options depending on which platform(s) your ANE supports. Below are four examples for packaging an ANE for:
Is that it?
Well, no. And it doesn’t have to be that painful either. This step can be automated together with the building of the native library and the AIR library, so you have a clean-built ANE in one step.
We are going to see how that’s done in the next article: Automatic ANE packaging.
So, which platforms did you try the command line for?