天天看點

Working tutorial to install AIR native extensions in Flash Develop 4

Installing a native extension in Flash Develop 4 on a Windows Desktop project is a pain in the ass, and the worst part is that the best tutorial you can get searching in google about this is incomplete and innacurate. I have a lot of experience working with native extensions so I decided to create my own tutorials on how to install them for Windows and for Mobile projects.

For a Windows app:

1) Create a folder named “lib” in your root Flash Develop project and copy the .ane file into the lib folder created.

2) Without leaving the lib folder make a second copy of the .ane file, rename it with .zip extension, unzip it and then delete the zip (You must end up with an .ane file and a folder with the contents of the .ane file).

3) Inside the unziped folder open the following file: META-INF\ANE\extension.xml

4) Copy the content of the <id> tag, for example: “com.myBuisness.myApp.air.SuperLibrary”

5) Rename the unzipped folder with the tag content we copied before and add the .ane extension to it like it was a file and not a folder, so the folder name must be something like this: “com.myBuisness.myApp.air.SuperLibrary.ane“

6) Go to Flash Develop and do right click on the ane file and then click on “add to library”

7) The Air project was created with some .bat files, you must modify them like this:

Packager.bat: replace the line that starts with “call adt” for:

call adt -package %OPTIONS% %SIGNING_OPTIONS% -target native %AIR_TARGET% %APP_XML% %FILE_OR_DIR% -extdir lib/

Run.bat: replace the line that starts with “adl “%APP_XML%” for:

adl “%APP_XML%” “%APP_DIR%” -extdir lib/

PackageApp.bat: replace the line “set AIR_TARGET=” for:

set AIR_TARGET=air/Setup.exe

8) Add the following to the application.xml:

<extensions>

<extensionID>PASTE HERE</extensionID>

</extensions>

9) Where it says PASTE HERE you must paste the content of the tag you copied in the step 4, so must look like this: <extensionID>com.myBuisness.myApp.air.SuperLibrary</extensionID>

10) Without leaving application.xml modify (or add if doens’t exist) the  supportedProfiles tag with only extendedDesktop value like this:

<supportedProfiles>extendedDesktop</supportedProfiles>

And thats it, the painfull process is finished, the extension must work and when you compile you get a .exe file (.air files cannot be created when using native extensions). The other tutorials dind’t help very much to create the .exe file or where to get the name of the folder, so this is the best one for the moment.

For a Mobile app:

1) Create a lib folder in your root Flash Develop project.

2) Copy the .ane file to the lib folder.

3) Go to Flash Develop and do right click on the .ane in the project explorer, then click on “add to library”.

4) Right click on it again and click “options” and selected the “External Library” radio button.

5) Go to Project > AIR App Properties, and on the Extensions tab, add the extension ID. If you don’t know the extension ID of the native extension you are using, follow the steps 2, 3 and 4 of the previous tutorial “For a Windows app”, then you can delete the folder created in those steps.

原文連結: http://fermmm.wordpress.com/2014/01/04/working-tutorial-to-install-air-native-extensions-in-flash-develop-4-windows-desktop-project/

繼續閱讀