Monday, October 3, 2011

AIR extensions in Java for Android Part 3 -- packaging the ANE

The AIR native extension is packaged in an ANE file. This is similar to an AIR file and is also created with the AIR ADT utility.




Collect the files
Currently there are no development tools that help with packaging native extensions (hmm, it shouldn't be too hard to write an AIR application for that), so this article shows you how to do things manually using the command line.

Collect all the files in central location so you have the following directories and files:
project (dir)
    extension.xml
    DataExchangeExtension.swc
    Android (dir)
        library.swf
        DataExchangeExtension.jar
        res (if used)

Create the package:
Run ADT from a command or terminal window:
/SDKs/AIR3/bin/adt -package
                                 -target ane DataExchange.ane
                                  extension.xml
                                 -swc AIRNativeExtensionAS.swc
                                 -platform Android-ARM
                                 -C Android
                                 DataExchangeExtension.jar library.swf

(This example is broken into separate lines to make it easier to read; when you type it in, do it all on one line.)

The library.swf can be the library.swf from the extension SWC (AIRNativeExteansionAS.swc in this case), but it doesn't need to be.
//Question -- what happens if the APIs in the SWC and that in library.swf for a platform are different? Supposedly you can have different APIs for different platforms, but this seems problematic at the app to extension interface level.

And there you have it. A native extension library.




No comments:

Post a Comment

Note: Only a member of this blog may post a comment.