Installing the Adobe AIR 2 Beta SDK on OS X
I’m sure I’m not the only one who was super stoked when Adobe released the beta of AIR 2.0. For those not familiar, Adobe added a laundry list of new toys, like support for mass storage devices, UDP sockets, and my personal favorite native code integration. You can check out the full list at Adobe Labs.
Of course, as these things always seem to go with beta stuff it wasn’t completely trivial to get things up and a running so I decided to write this post up. Note these instructions assume you’re using Flex 3 and Flex Builder 3, but there’s no reason this shouldn’t work with Flex 4 and Flash Builder 4. I haven’t tried this yet because I haven’t made the jump myself, but would love to hear from anyone who can verify this. Without further ado…
1. Download and run the AIR 2.0 runtime and SDK – http://labs.adobe.com/downloads/air2.html
2. Make a copy of your Flex SDK – On OS X this should located in ~/Applications/Adobe\ Flex\ Builder\ 3/sdks. I called mine “3.4andAir2″. Alternatively if you haven’t updated your flex SDK in a while you can get the latest version of Flex 3 from here.
3. Overlay the AIR 2 SDK over the copied SDK – Since the AIR SDK is interwoven with the Flex SDK this is actually a bit tricky. I first tried to do it manually by copying over each relevant file and folder. I’m not sure if I was careless, but flex builder didn’t recognize any of the AIR 2.0 API calls. Luckily, I did a bit of search and found the “ditto” command, which will do exactly what we need. Once you’ve mounted the AIR 2 dmg, open up your terminal and you can use ditto as follows to overlay AIR 2.0:
ditto -V /Volumes/AIR\ SDK/ /Applications/Adobe\ Flex\ Builder\ 3/sdks/3.4andAir2/
This should ovewrite the AIR 1.5 SDK with AIR 2.0 SDK.
4. Add the new SDK to Flex Builder – Go to Flex Builder > Preferences > Installed Flex SDKs > Add… Point it to your 3.4andAir2 sdk folder you made.
5. Start a new project
6. Change compiler settings to point to the new SDK – Project > Properties > Flex Compiler > Use a Specific SDK
7. Change the application descriptior file - Change the line 2 to: <application xmlns=”http://ns.adobe.com/air/application/2.0beta”>
8. Verify – Add the following line of code and make sure you don’t get any build errors:
That’s it! Stay tuned for my next post where I’ll dig into the NativeProcess API!
Update: In response to my blog post Christian Cantrell, AIR product manger, pointed out the key to getting the overlaying to work is not using the finder. Other methods besides ditto also work like cp -r and tar -xfj