Package your ANE in Flash Builder

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

I keep advocating single-click builds and it’s time to put my money where my mouth is. This article will show you how to set up Flash Builder to rebuild and package an AIR Native Extension with one click.

Step 1: Create a build script that automates the ANE packaging

Automatic ANE Packaging walks you through making a build script and customizing it. You should have an Ant script in your AIR library project, which is an XML file with build instructions. It’s called build.xml in the example below:

ANE build script

No time to go through all this? No worries, we have ready-made build scripts you can use. Scroll to the bottom of the post to see how you can request one. It’s free, by the way.

Step 2: Add a builder to your Flash Builder project

Now you’ll get Flash Builder to run your script when you do Project > Build Project.

2.1. Open the Properties dialog of your AIR Library project and select Builders from the list on the left:

Flash Builder - Builders

2.2. Click New… and create a new Ant Builder:

Create a new Ant builder

2.3. Inside the Edit Configuration dialog:

  • Name your builder.
    Tip: the name needs to be unique for your Flash Builder workspace. You can’t have two different projects, each using a builder with the same name. Go figure…
  • Then select your build file – that would be the XML Ant script you prepared in Step 1. 
    Tip: Having your build script as part of your project and selecting it via Browse Workspace… would save you having to change paths if you share the project with colleagues or build it on a different machine.

Configure the Ant builder

 2.4. OK the last dialog. You should now see your builder listed under the default Flex one. Tick the box next to it to select it. This will cause your build script to be executed when you do Project > Build Project in Flash Builder.

Ant builder is ready

 

3. Try it out

That’s it. I know, hard to believe this last stage is so short, given the amount of work you did in putting the build script together.

Go on, try it. Select your project in Flash Builder and do Project > Build Project. I know… that’s technically two clicks. I really wish Flash Builder had a shortcut for building a single project, rather than just for Build All…

You should be able to see the script at work in the Console window (Window > Show View > Console):

Build your ANE in Flash Builder

 

At the end of all this there should be an ANE waiting for you. And where would that be? Well, wherever you set up your build script to create it.

4. Build/packaging errors?

Give us a shout in the comments below. We want to help and we don’t bite. Much.

In a hurry?

We have created a set of template build scripts which you can use to automatically build and package native extensions for iOS, Android, Mac OS and Windows. Leave a comment below and let us know if you want one e-mailed to you and which platform(s) you need it to support.

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

  1. Eric Zwar

    Hi, I am trying to learn how to build a simple ANE for a windows desktop AIR Native Extension. The native extension app at this stage should merely echo a string back that is provided to it. I am trying to do the native extension in C++.

    Thanks in advance for the build script.

    Regards, Eric.

    • Radoslava

      Hi Eric,

      I have just e-mailed you the Windows build scripts. I hope they do a good job for you. Get in touch if you have questions.

      Cheers,
      Radoslava

  2. Radoslava

    Hi Eric,

    Thanks for getting in touch.
    To make sure we send you the right scripts: the ANE will run on iOS and Android – is that correct?

    Greetings,
    Radoslava

    • Radoslava

      Hi B,

      I have emailed you a set of build scripts + a README file. Let us know how they are working for you.

      Cheers,
      Radoslava

  3. Mark

    Hi. I’m building a simple ANE for Android-ARM and Android-x86 to add support for the Android TV banner icon to my app’s manifest without having to unzip and re-sign my release build. I could wait for Adobe to add that compatibility to the AIR SDK (as they did with for OUYA’s unusual icon), but who knows how long that will take…

    I’m just making this for my own use (and I don’t know if it will work), but I’ve already written a pretty good AS implementation so I’d like to be able to offer it to others if I can figure out a way to put any arbitrary asset in the native “res” folder just using Java (I don’t totally know what I’m doing on that side).

    Thanks for offering this! I should only need the Android script, but I’d be interested in scripts for other platforms as well for potential future development. Why aren’t you just posting links to these scripts? They’re not personalized, are they?

    • Radoslava

      Hi Mark,

      I’ve just emailed you build scripts which you can use to build and package ANEs for iOS, Mac OS, Android and Windows. There is a readme file in the package that explains how to use them.

      You will need to do some additional work on the script for Android to have it add assets to res/. If you can get Eclipse to do that for you, you can generate an Ant script from that as shown in the readme file.

      Let us know how the scripts are working for you and if any clarification is needed.

      Cheers,
      Radoslava

  4. Emad

    Hi. I’m building a simple ANE to run on iOS, Mac OS, Android and Windows.
    Can i generate one ANE to run on all platforms.
    thanks
    Emad

    • Radoslava

      Hi Emad,

      I have just emailed you the build scripts which you can use to build and package ANEs for iOS, Mac OS, Android and Windows. There is a readme file in the package that explains how to use them.
      Let us know how they are working for you and if any clarification is needed.

      You can package a single ANE for all four platforms. For that you will need to do the following:
      – list all the platforms in your extension descriptor file;
      – if you package your ANE using the build scripts I have sent you, you will need to add another package target, which calls ADT for all platforms at the same time; for example, if you wanted to do iOS, Android and simulator support together, the arg line for ADT in the target may look like this:

      -package
      -target ane
      ane/${ane.name}.ane
      ${air.extension.descriptor}
      -swc ../${air.library.name}/swc/${air.library.name}.swc
      -platform iPhone-ARM
      -C . .
      -platformoptions ${air.platform.descriptor}
      -platform Android-ARM
      -C . .

      -platform default -C ${default.swcdir} library.swf
      Cheers,
      Radoslava

  5. Jesmar Raga

    Hi Radoslava,

    Very good all the tutorials by the way, congratulations and thanks for sharing it

    Would you send me a template build script for Windows?, please

    Thanks in advance

    Regards,

    Jesmar Raga

    • Hristo

      Hi Jesmar,

      Thank you for the kind words.

      I have just e-mailed you the Windows build scripts. I hope they do a good job for you. Get in touch if you have questions.

      Cheers,
      Hristo

  6. Nimrod

    Hello, Thank you for the detailed and useful tutorials!
    1. Do you know about any limitations to use ANE that its ActionScript part created using flash CC, from project build in CS6 ?
    2. Is there any built-in options to package ANE from Flash CS6 or Flash CC (Animate CC ?)
    3. Can you send the Windows build scripts for the ANE packaging. Can I run it from Flash CC or only from Flash builder?
    Thank you
    Nimrod

    • Hristo

      Hi, Nimrod,

      On your questions:

    • As far as I know there isn’t any problem using ANEs in a Flash CS6 or Flash CC project. Just be sure to use the same or greater AIR SDK version than the one that is used by the ANE.
    • If you want to create ANEs you should consider using Flash Builder, Flash application doesn’t provide you with the interface for ANE building tools.
    • I have just e-mailed you the build scripts for Windows. The current version of the script is designed to be used in Flash Builder only.
    • Get in touch if you have more questions.

      Cheers,
      Hristo

  7. Kim Jensen

    I’m using Flash Builder 4.6 and I have an iPhone application that need to be update so I can upload it with the 64 bit support required by Apple. Can you send the Ana I need. I do not see any bin or Build Script folder in my project. I only have a bin-debug folder.

  8. 964620315

    Hi, I am trying to learn how to build a simple ANE for a windows desktop AIR Native Extension. The native extension app at this stage should merely echo a string back that is provided to it. I am trying to do the native extension in C++.

    Thanks in advance for the build script.

    Regards, Liu.

    • Hristo

      Hi Liu,

      I have just e-mailed you the Windows build scripts. I hope they do a good job for you. Get in touch if you have questions.

      Cheers,
      Hristo

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="">