Adobe
Products

Top destinations

  • Adobe Creative Cloud
  • Creative Suite
  • Adobe Marketing Cloud
  • Acrobat
  • Photoshop
  • SiteCatalyst
  • Students
  • Elements family

Adobe Creative Cloud

  • What is Adobe Creative Cloud?
  • Design
  • Web
  • Photography
  • Video
  • Students
  • Teams
  • Enterprise
  • Educational institutions

Design and photography

  • Photoshop
  • Illustrator
  • InDesign
  • Adobe Muse
  • Lightroom

Video

  • Adobe Premiere
  • After Effects

Web development and HTML5

  • Edge Tools & Services [opens in a new window]
  • Dreamweaver
  • Gaming [opens in a new window]

Adobe Marketing Cloud

  • What is Adobe Marketing Cloud?
  • Digital analytics
  • Social marketing
  • Web experience management
  • Testing and targeting
  • Media optimization

Analytics

  • SiteCatalyst
  • Adobe Discover
  • Insight

Social

  • Adobe Social

Experience Manager

  • CQ
  • Scene7

Target

  • Test&Target
  • Recommendations
  • Search&Promote

Media Optimizer

  • AdLens
  • AudienceManager
  • AudienceResearch

Document services

  • Acrobat
  • EchoSign [opens in a new window]
  • FormsCentral [opens in a new window]
  • SendNow [opens in a new window]
  • Acrobat.com [opens in a new window]

Publishing

  • Digital Publishing Suite

  • See all products
Business solutions

By business need

  • Digital analytics
  • Digital publishing
  • Document management
  • Media optimization
  • Social marketing
  • Testing and targeting
  • Video editing and serving
  • Web development [opens in a new window]
  • Web experience management
  • See all business needs

By industry

  • Broadcast
  • Education
  • Financial services
  • Government
  • Publishing
  • Retail
  • See all industries
Support & Learning

I need help

  • Products
  • Adobe Creative Cloud
  • Adobe Marketing Cloud
  • Forums [opens in a new window]

I want to learn

  • Training and tutorials
  • Certification [opens in a new window]
  • Adobe Developer Connection
  • Adobe Design Center
  • Adobe TV [opens in a new window]
  • Adobe Marketing Center
  • Adobe Labs [opens in a new window]
Download
  • Product trials
  • Adobe Flash Player
  • Adobe Reader
  • Adobe AIR
  • See all downloads
Company
  • Careers at Adobe
  • Investor Relations
  • Newsroom
  • Privacy
  • Corporate Social Responsibility
  • Customer Showcase
  • Contact us
  • More company info
Buy
  • For personal and professional use
  • For students, educators, and staff
  • For small and medium businesses
  • Volume Licensing
  • Special offers
  • Adobe Marketing Cloud sales [opens in a new window]
Search
 
Info Sign in
Why sign in? Sign in to manage your account and access trial downloads, product extensions, community areas, and more.
Welcome,
My Adobe
My orders
My information
My preferences
My products and services
Sign out
My cart
Privacy My Adobe
Adobe
Products Sections Buy   Search  
Solutions Company
Help Learning
Sign in Sign out Privacy My Adobe
Preorder Estimated Availability Date. Your credit card will not be charged until the product is shipped. Estimated availability date is subject to change. Preorder Estimated Availability Date. Your credit card will not be charged until the product is ready to download. Estimated availability date is subject to change.
Qty:
Purchase requires verification of academic eligibility
Subtotal
Promotions
Estimated shipping
Tax
Calculated at checkout
Total
Review and Checkout
Adobe Developer Connection / Adobe AIR Developer Center /

Building a native extension for iOS and Android – Part 5: Building the ANE file

by Nathan Weber

Nathan Weber
  • digitalprimates.net

Content

  • Building the ANE file
  • Including the ANE file in an application
  • Where to go from here

Created

27 August 2012

Page tools

Share on Facebook
Share on Twitter
Share on LinkedIn
Bookmark
Print
ActionScriptAdobe AIRAndroidFlash BuilderiOSmobilenative extensions
Was this helpful?
Yes   No

By clicking Submit, you accept the Adobe Terms of Use.

 
Thanks for your feedback.

Requirements

Prerequisite knowledge

This series of tutorials is designed for developers with an intermediate to advanced understanding of ActionScript 3 and building Adobe AIR applications. Familiarity with Flash Builder, Java, and Objective-C will also be helpful. If you have not already done so, read Part 1, Part 2, Part 3, and Part 4 before proceeding.

 

Additional required other products

  • Volume native extension

User level

Intermediate

Required products

  • Flash Builder (Download trial)
  • Adobe AIR SDK

Sample files

  • system-volume-native-extension.zip

In earlier tutorials in this series, you created the main and default ActionScript libraries, the iOS library, and the Android library for a native extension. Now that all of the supporting projects have been built, it's time to put it all together. For native extensions, that means building an ANE file using the ADT tool.

Because Flash Builder does not yet support building ANE files, you must use the command line ADT tool, which is packaged with the AIR SDK. The ADT tool is located in AIR_SDK_DIR/bin.

Building the ANE file

  1. Follow the steps below to build your ANE file:
  2. Put all of the files into a folder using the structure below:
build directory android -androidLib.jar -library.swf (main ActionScript library) ios -iOSLib.a -library.swf (main ActionScript library) default -library.swf (default library) -extension.xml -platformoptions.xml (if required) -SWC for main ActionScript library
Figure 1. Build directory for the Volume native extension
Figure 1. Build directory for the Volume native extension

Note: The library.swf file is inside of the SWC file that the ActionScript project generates. Simply extract the contents of the SWC as if it was a ZIP file and you'll see the library.swf file.

  1. Navigate to the build directory you've created. On OS X use the Terminal and on Windows use the command prompt. Run the following command:
adt -package -target ane Output.ane extension.xml -swc VolumeLib.swc -platform iPhone-ARM -C ios . -platformoptions platformoptions.xml -platform Android-ARM -C android . -platform default -C default .

In the command above, –C directory . indicates that all of the files in directory should be included in the ANE file. In contrast, –C directory library.swf would include only the file directory/library.swf in the ANE file.

Signing the native extension is optional. If you don't sign it Flash Builder will probably complain about it, but everything will still work as expected. To sign the ANE file, use any p12 certificate you have. If you don't have one, you can generate one from Flash Builder. Then, add these parameters to the command above:

-storetype pkcs12 -keystore cert.p12 -storepass XXXX

If you're not supporting both iOS and Android, be sure to exclude the platform that you aren't supporting. You want the platforms used here to mirror the ones defined in the extension.xml.

Note: If you're having trouble running ADT, see Building Adobe AIR Applications—Path environment variables. If you get an error indicating "invalid extension.xml" there's a chance the extension.xml file can't be found. Be sure you are running the command from the build directory.

Including the ANE file in an application

Follow these steps to include the ANE file in your project:

  1. Go to the properties of your project in Flash Builder.
  2. Select Flex Build Path and click the Native Extensions tab.
  3. Click Add ANE and navigate to the ANE file you built.
  4. At some point, either during this step or one of the following steps, Flash Builder should indicate that the package of the ANE must be included in the app descriptor file and that Flash Builder will automatically include it. Click Yes to this prompt.
  5. Now that your native extension has been added, you must toggle it on for each platform you are supporting. In the Properties dialog box, select and expand Flex Build Packaging.
  6. If you are supporting iOS, select Apple iOS and click the Native Extensions tab. Be sure that the checkbox in the Package column of your native extension is checked. Also be sure to specify the path to the iOS SDK (as mentioned previously) as the Apple iOS SDK setting. Click Apply.
  7. If you are supporting Android, select Google Android and click the Native Extensions tab. Be sure that the checkbox in the Package column of your native extension is checked. Click Apply.
  8. Click OK and choose Project > Clean to clean your project. You're ready to implement the native extension now!

If you make any changes that require you to rebuild the ANE file, I recommend removing the native extension from the Flex Build Path > Native Extensions tab and repeating the steps above to re-add the ANE file to your project. I've had some caching issues that caused an old version of the extension to be used if I didn't totally remove it and start the add process over from the start.

If you make changes to any of the libraries, be sure to update the files in the build directory. It's especially easy to overlook extracting the library.swf file from the main ActionScript library's SWC file. Also be sure to place this library.swf file in both the iOS and Android directories.

It's not difficult to automate this process via ANT. I don't cover it here, but many projects use ANT to perform the entire packaging process. You can even extract the library.swf file from the SWC file using ANT.

Where to go from here

Many steps are involved in creating a native extension for Adobe AIR, but following the steps in this tutorial series will help you avoid overlooking some of the finer details that are required to get it all working. You can find great examples of native extensions on the Adobe AIR Developer Center. I encourage you to check them out to get an even better understanding of what native extensions can do.

Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Unported License.

More Like This

  • Developing cross-platform Adobe AIR applications
  • Performance-tuning Adobe AIR applications
  • Using Badger for Adobe AIR applications
  • Building a native extension for iOS and Android – Part 2: Developing the ActionScript library
  • Creating your first Adobe AIR application on Android
  • Using web fonts with Adobe AIR 2.5
  • Signing Adobe AIR applications
  • Using push notifications in AIR iOS apps
  • Building Lupo: A case study in building commercial AIR applications
  • Using the Push Notifications native extension for iOS

Products

  • Adobe Creative Cloud
  • Creative Suite
  • Adobe Marketing Cloud
  • Acrobat
  • Photoshop
  • Digital Publishing Suite
  • Elements family
  • SiteCatalyst
  • For education

Download

  • Product trials
  • Adobe Reader
  • Adobe Flash Player
  • Adobe AIR

Support & Learning

  • Product help
  • Forums

Buy

  • For personal and professional use
  • For students, educators, and staff
  • For small and medium businesses
  • Volume Licensing
  • Special offers

Company

  • News room
  • Partner programs
  • Corporate social responsibility
  • Career opportunities
  • Investor Relations
  • Events
  • Legal
  • Security
  • Contact Adobe
Choose your region United States (Change)
Choose your region Close

North America

Europe, Middle East and Africa

Asia Pacific

  • Canada - English
  • Canada - Français
  • Latinoamérica
  • México
  • United States

South America

  • Brasil
  • Africa - English
  • Österreich - Deutsch
  • Belgium - English
  • Belgique - Français
  • België - Nederlands
  • България
  • Hrvatska
  • Česká republika
  • Danmark
  • Eastern Europe - English
  • Eesti
  • Suomi
  • France
  • Deutschland
  • Magyarország
  • Ireland
  • Israel - English
  • ישראל - עברית
  • Italia
  • Latvija
  • Lietuva
  • Luxembourg - Deutsch
  • Luxembourg - English
  • Luxembourg - Français
  • الشرق الأوسط وشمال أفريقيا - اللغة العربية
  • Middle East and North Africa - English
  • Moyen-Orient et Afrique du Nord - Français
  • Nederland
  • Norge
  • Polska
  • Portugal
  • România
  • Россия
  • Srbija
  • Slovensko
  • Slovenija
  • España
  • Sverige
  • Schweiz - Deutsch
  • Suisse - Français
  • Svizzera - Italiano
  • Türkiye
  • Україна
  • United Kingdom
  • Australia
  • 中国
  • 中國香港特別行政區
  • Hong Kong S.A.R. of China
  • India - English
  • 日本
  • 한국
  • New Zealand
  • 台灣

Southeast Asia

  • Includes Indonesia, Malaysia, Philippines, Singapore, Thailand, and Vietnam - English

Copyright © 2013 Adobe Systems Incorporated. All rights reserved.

Terms of Use | Privacy | Cookies

Ad Choices

Reviewed by TRUSTe: site privacy statement