Native Extensions for Android with Air 3 and Flashdevelop

I spent a day or so recently wrangling with the new Native Extension capabilities introduced in Air 3, so thought I’d post up some details of my findings.

Firstly, I’ll be honest and say that I found the process (starting from scratch) to be quite convoluted.

I got pointers in (mostly) the right direction from here, here and here. But I was still struggling with how to use FlashDevelop to get the compilation of java files, and packaging of the ANE.

That’s where the Ant script that was included in the Git hub of Small Screen Design helped greatly! I made some tweaks and managed to get Christian Cantrell’s original compass app (which wasn’t supplied with the .ane file) to compile and package successfully.

You can download my FlashDevelop project folder to see the build.xml file and the structure which I’ve used.

CompassNativeExtension.rar

Hope this helps others struggling with getting their head around the seemingly dizzying number of hoops to jump through to get Native Extensions humming along 😉

Please follow and like us:

9 thoughts on “Native Extensions for Android with Air 3 and Flashdevelop”

  1. Without a proper foundation on ANE, it going to be chao. I lost count how many “here” links I read and still having some doubt.

    Reply
  2. i feel with no brain, completly idiot…i downloaded you project, open it in flash develop to compile it but always get 1014 error trying to find compass class on com.christiancantrell.extensions…i need to use compass data in a proyect i am doing in flash, specifically to rotate a ppv sphere…could you help me on this? can i use the swc in a flash project? any help should be greatly welcomed

    Reply
  3. Hi Milton,

    You need to just compile the swf using FlashDevelop, not actually run it – that’s when you get the error you’re seeing.

    Once you’ve got the SWF, you then use the ANT build script to build the ANE and then the APK from that.

    Reply
  4. Hi Jason

    Great work

    I’m a flash developer and a compass would be fantastic for a project I’m working on, but I’m not sure what code I need to access the classes and what source paths/library path I need to get this working I keep getting this error:

    1120: Access of undefined property ExtensionContext.

    Reply
  5. Hi Jason – Thanks for the reply

    I was using Flash cs5 (with an AIR for Android extension) and trying to include the .ane file location as a Library Path in the Actionscript Publish settings. It seems you can’t do this with cs5 (I read on the Adobe website that you can use cs5.5 and rename the .ane file to a .swc and then locate it in the Library Path as using the .swc locate button) Anyway, I downloaded cs6 as a trial, and it has a dedicated button for browsing to .ane files in the Library Path area. So I didn’t manage to get your project working cause I haven’t tried it with cs6, but I got other .ane files to work yesterday (all packaged nicely and working on my phone!!), so I imagine it’ll be no problem… my fault for not upgrading soon enough… Thanks again!!

    Reply

Leave a Comment