Windows ANE tutorial: Packaging the ANE

This is part 4 of our Windows ANE tutorial which walks you through making an Adobe AIR Native Extension for Windows.

At the end of this part you will have:

An Adobe AIR Native Extension (ANE) ready to be used on Windows.

Time

10-15 minutes

Wait, have you done this first?

Option 1: Package the ANE by hand

Ahh, even my keyboard is shaking with distaste as I’m typing this… I have a reputation for passionately hating build processes that require more than a single click. Option 1 has… well you count how many clicks, drags and head-scratches it has.

Realistically, though, if this is your first ANE or first one for Windows, packaging it by hand is a great option. It shows you what goes in and will give you ideas for how to automate the process. Or will help you understand the automatic build scripts I will send you. If you ask me nicely in the comments below, that is.

Without further ado, let us roll up our sleeves and do some packaging…

1. Extract library.swf

When you built your AIR library in the previous step you probably got a SWC file in your project’s bin folder, called DiaDrawWindowsANETutorialAIRLib.swc. In there somewhere library.swf hides. Here is how to get to it:

Make a copy of DiaDrawWindowsANETutorialAIRLib.swc and rename it to DiaDrawWindowsANETutorialAIRLib.zip and unzip it. This should produce two files: catalog.xml and library.swf. Discard catalog.xml and the renamed .zip file and keep library.swf.

2. Collect all ingredients

For Windows these will be:

  • library.swf, which you just extracted
  • DiaDrawWindowsANETutorialAIRLib.swc (you didn’t get rid of it, did you?)
  • DiaDrawWindowsANETutorialAIRLib-extension.xml – the extension descriptor file which you created in Part 3: Set up the AIR Library
  • DiaDrawWindowsANETutorialDLL.dll – the native library you built in Part 2: The Native DLL code

3. Go on the command line

Copy all of the ingredients listed above into one folder and navigate to it from Windows Command Prompt.

Run the following command:

What this does is run the AIR SDK adt utility and instruct it to package the files you have collected into an ANE product (target) for Windows.

Note that if adt.bat is not on your Windows search path, you can provide the full path to it. Adt.bat normally lives in the bin folder of your AIR SDK, for example: C:/Program Files (x86)/Adobe/Adobe Flash Builder 4.6/sdks/4.6.0/bin/adt.bat. Don’t forget to put the path in quotes, as Command Prompt doesn’t like spaces in paths.

Here is a much more illustrated version of the steps described above: Recipe for packaging an ANE.

If packaging was successful you should end up with DiaDrawWindowsANETutorial.ane in the same folder where you ran the packaging command.

ANE has been built

Option 2: Automate your ANE packaging

An automatic build? Now we’re talking. All that shenanigans of gathering files, renaming, unzipping, running commands by hand takes time. And if you have to do that for every single change you do in your code and want to debug it (you do debug, yes?), what are the chances of you doing that often versus coding away blind?

So. Check out these two tutorials:

You will probably notice these walk you through creating build scripts for iOS. Well, dedicated reader, here is a little homework for you: the same principles apply for making a build script for Windows, Android or Mac OS.

If you are in a hurry and want the ready-made scripts for Windows, shout in the comment section below. A recommended opening line is “Automated builds rock because…” 😀

What’s next?

.

Opt In Image
Early bird offer on the ANE eBooks

 

Buy any Easy Native Extensions 2nd Edition package and get our $99 iOS + Android ANE Template completely free before the end of June 2015.

 

 

  • step-by-step guide to making your iOS extension in under an hour
  • library for data conversion between ActionScript and native code
  • tutorials
  • infographics
  • code included

Warning: count(): Parameter must be an array or an object that implements Countable in /home/easyna6/public_html/easynativeextensions_wp/wp-includes/class-wp-comment-query.php on line 399

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">