Creating an Adobe AIR Native Extensions on the Mac

Datetime:2016-08-23 02:58:05         Topic: Xcode  Adobe Flex          Share        Original >>
Here to See The Original Article!!!

A Step by Step procedure for how to create an Adobe AIR Native Extensions on the Mac-

Step -1 (Create a New Xcode Project)

  • File->New->Project->select on left side OS X >Framework & Library -> select Cocoa Framework->click next
  • Enter Product Name : SampleANE
  • Company Identifier : com.riaxe [You can change it whatever you want]
  • Click next

Step-2 (Setting the project)

  • Select “SampleANE” under “Project”
  • Select “Build Settings” on right side
  • Ensure “All” | “Combined” are selected
  • Ensure the below are set in each sections with the values:
  • Under “Architectures”
    • Architectures to “Standard (32/64-bit intel) – $(ARCHS_STANDARD_32_64_BIT)
    • Base SDK to “Mac OS X 10.6″
      • Under “Build Options”

Compiler for C/C++/Objective-C to “LLVM GCC 4.2″

  • Under “Deployment”
  • Mac OS X Deployment Target to “Mac OS X 10.6″
  • Under “Linking”

Compatibility Version to “1″

Current Library Version to “1″

Other Linker Flags to “-flat_namespace -weakFramework” [Note: This is a list first add -

weakFramework & then -flat_namespace, yielding in -flat_namespace -weakFramework]

  • Under “Packaging”

Wrapper extension to “framework”

  • Under “Search Paths”

Framework Search Paths to “/Applications/Adobe\ Flash\ Builder\ 4.7/sdks/4.6.0/runtimes/air/mac”

  • Under “LLVM GCC 4.2 – Code Generation”

Optimization level to “None [-0o]“

That completes the settings of the Xcode project. Now let’s go ahead and write the code. If you have noticed on right hand side Tree two files have already been created for us

  • SampleANE.h
  • SampleANE.m

Now we need to add Adobe AIR framework/library:

  • Right Click on “SampleANE” folder or Project
  • Click on ‘Add Files to “SampleANE”…’
  • Browse through path Application > Adobe Flash Builder 4.7> sdks > 4.6.0 > runtimes > air > mac > Adobe AIR.framework
  • Click “Add”.

Note: Adding Adobe Air framework after doing build settings would create a small problem. I hope you guys remember, we set Framework Search Path with ”/Applications/Adobe\ Flash\ Builder\ 4.7/sdks/4.7.0/runtimes/air/mac”, now if you select SampleANE under Target & check Framework Search Path, it would have now repeated twice. Leaving out this as is shouldn’t matter, but i have noticed sometimes this creates issues while compiling the project. The fix for this is that you have to ensure you have only one “/Applications/Adobe\ Flash\ Builder\ 4.7/sdks/4.7.0/runtimes/air/mac” in Framework Search Path.

Note : Next thing to do is that we need to test our configuration by building the framework. I know you would be thinking without any code why are we building, and the answer is just to ensure, it compiles well with all the settings we have made. Remember in the Architecture settings we said that it is Standard 32/64 bit intel architecture, hence let’s build for 32 Bit and find if it has any issues. Also note that Adobe AIR framework/library which we just added supports only 32 bit, hence we need to change our build to be 32 bit for doing so follow the below screen shot

If all goes well, you should see above screen with one warning, this warning would appear as if you are using LION & Xcode’s latest SDK is 10.7, since we are using 10.6 it would complain and ask us to upgrade, you can ignore this warning

Next Step Would Be Creating Flex Library project which accommodates or acts like a wrapper for our extension:

  • Criate Flex & libray Project >project name and include Adobe AIR libraries >finish
  • Criate a PK RHS on project >New >Package
  • Create Action Script Class and Subclass is EventDispatcher
  • Create New >File>manifest.xml
  • RHS of the project .>Properties>select Flex Library Compiler >then

Namespace URL >

Additional compiler arguments: we have added one more argument

-swf-version 13

  • Criate a Folder inside Project like ANEBuild
  • Here you need to copy the SampleANELib.swc [Output of Flex Library project], SampleANE.framework [Output of the Xcode project] & descriptor.xml which holds the definition for the ANE [You will get this along side the source code at the end of the post]. Note: If you have problems locating the SampleANE.framework, use the menu’s in Xcode [XCode > Preferences > Locations > Locations], look for Derived Data path & you would navigate their to find you SampleANE.framework.
  • Now that our ANEBuild folder is set

ANE Creation

    • Open Terminal

    Type “export PATH=$PATH:/Applications/Adobe\ Flash\ Builder\ 4.7/sdks/4.6.0/bin” & then press enter, this should add Flex SDK path temporarily for this session of Terminal

    • Check by using “echo $PATH”
    • Now that we have set SDK path, first step in building ANE is that we need unzip the contents of SampleANELib.swc, this you could do by using JAR command as show below screen shot


    • JAR –xvf SampleANELib.swc
    • Next building the actual ANE. use adt command as follows

    [Command : adt -package -target ane Sample.ane extension.xml -swc SampleANELib.swc -platform MacOS-x86 –c mac]

    This would Generate Sample.ANE

      #adobe air native extensions

      #adobe air native extensions mac

      #create adobe air native extensions

      #Mac OS X 10.6


Put your ads here, just $200 per month.