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 ;-)

Be Sociable, Share!
Tagged with: , , , , , ,
Posted in Air

8 comments on “Native Extensions for Android with Air 3 and Flashdevelop
  1. James says:

    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.

  2. milton ortiz says:

    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

  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.

  4. milton ortiz says:

    thanks a lot jason, already solved inside flash ide, i found a site explaining how

  5. Steve Grady says:

    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.

  6. Jason Langdon says:

    @Steve – what IDE are you using to compile your app with? I’m only really familiar with FlashDevelop these days.

    You might want to check out posts like this (http://stackoverflow.com/questions/12511786/how-to-use-extensioncontext-in-flash-builder-4-6) as well, could help point you in the right direction.

  7. Steve Grady says:

    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!!

1 Pings/Trackbacks for "Native Extensions for Android with Air 3 and Flashdevelop"
  1. [...] Native Extensions for Android with Air 3 and Flashdevelop at calm in the chaos [...]

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> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Posts this month
November 2011
M T W T F S S
« Aug   Feb »
 123456
78910111213
14151617181920
21222324252627
282930  
Archives