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:
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:
2.2. Click New… and 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.
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.
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):
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.
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
Eric Zwar
Hi Radoslava, this works just great!!
Thanks, Eric.
Eric Stanley
Hi,
I am currently building an app in Starling and Feathers which requires access of mobile contacts. I already found the NativeExtention in https://github.com/memeller/ContactEditor
I am using a windows PC and all I need is the same build scripts that you have shared to the other Eric
Regards,
Eric Stanley
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
Eric Stanley
Forgot to mention that. My bad.
And YES. You are correct Radoslava
Radoslava
Great, I’ve emailed you a set of build scripts for Android and iOS. Let us know how they are working for you.
Cheers,
Radoslava
Kartik
Hi,
I am looking for 64bit ane of https://github.com/memeller/ContactEditor can you please post it if you have 64bit ane of same.
It will be a great time saver for me.
Thanks in advance.
Regards,
Kartik
b
Can pls have a template for iOS- thanks. Also, thanks for the tutorial.
-B
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
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
Mark
Thanks!
dan
can someone recompile this for Adobe AIR sdk 16+ ?
because when I publish my flash PRO app it says: required to have universal iOS libraries (works with AIR SDK 14, but AIR SDK 14 is no longer accepted in appstore)
https://github.com/sewonist/FlashLight/blob/master/actionscript/src/com/itpointlab/ane/FlashLight.as
thanks,
Dan
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
davidcaneso
can you send me the build scripts please.
Thank you
Radoslava
Hi David,
Which platforms will you need build scripts for?
Cheers,
Radoslava
sandeep
can u tell me how to move internal sd card data to external sd card using in adobe ANE
Radoslava
Hi Sandeep,
Have you tried the Environment module? (I’m guessing you need to do that on Android, though I may be wrong.)
http://developer.android.com/reference/android/os/Environment.html#getExternalStorageDirectory()
As to how to package it in an ANE, we have an Android ANE template project, which you may find useful: http://easynativeextensions.com/product/ios-android-ane-template/
Hope that helps,
Radoslava
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
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:
Get in touch if you have more questions.
Cheers,
Hristo
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.
Radoslava
Hi Kim,
The Build Script folder is not automatically a part of Flash Builder projects. The previous tutorial shows you how to set it up and create the scripts in it: http://easynativeextensions.com/automatic-ane-packaging/
Cheers,
Radoslava
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