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 SDKhttp://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:

private var process:NativeProcess

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

  • Pingback: Michael Christoff » Using the AIR 2.0 NativeProcess API to control MPlayer()

  • http://asawilliams.org/ Asa Williams

    Thanks for the post. My earlier attempts to install the sdk failed. This should be a big help!

  • chrisz

    Hi,

    im using flex sdk 3.0, an i cant compile with <supportedProfiles>extendedDesktop</supportedProfiles>

    when i use
    <supportedProfiles>extendedDesktop</supportedProfiles>
    i can compile without nativeprocess support.
    Any Idea ?

    My adt is 1.5.xxx

    greetz

  • chrisz

    opps, wrong, when i use
    <supportedProfiles>desktop</supportedProfiles>
    i cam compile, without nativeprocess support.

  • http://mixwit.com Michael Christoff

    try doing a clean on your project in flex builder. that seemed to work for a friend of mine.

  • chrisz

    Hello,

    its the same. I think the adl (version 1.5.xx) is to old. Can i integrate the adl 2.0.xx into Flex/Flash builder ?

    Thanks for answere…

  • http://mixwit.com Michael Christoff

    yup, you'll need to install the 2.0 runtime and overlay the sdk. this
    should replace the current adl.

  • chris

    Have you had any luck exporting a release build using the new Air 2.0 stuff? I'm working on a project that requires it and I'm having difficulty making my release… when I do File -> Export Release Build, I get this message:

    Error creating AIR file: my-app.xml: error 306: Descriptor must support the profile desktop, mobileDevice, or extendedMobileDevice

    Why can't I seem to make a build using extendedDesktop?

    Any luck?

  • chris

    I found a German blog where someone detailed the issue and how to build from the command-line… but I need to target Linux and they only seem to have instructions for Mac and Windows.

    http://www.video-flash.de/index/nativeprocess-a

    Any ideas? Can I just build a .deb or something using the same instructions?

    Unfortunately my Linux machine doesn't have network access so I'm running back and forth between my Mac laptop and the Linux box I'm targeting the app towards trying to see if I can get it working — big pain in the ass. Virtual Machine might be my best option.

  • http://www.prontonetworks.com/ Srigiri

    Hi,

    Happen to get any reply on this? I am facing the same problem., Not able to export .

    Thanks in advance,
    Sri

  • gurkerl

    hi,

    i was able to export with the declaration

    <supportedProfiles>extendedDesktop desktop</supportedProfiles>

    it is described here http://forums.adobe.com/thread/532531?tstart=30

  • Sergio Eurico

    Thank you for the info!
    Really nice post!

  • ghjunior

    Just a heads up that for anyone using Air 2 Beta 2 the namespace used in the descriptor file should be: http://ns.adobe.com/air/application/2.0beta2

    Cheers,
    Greg

  • geekreef

    I am able to get the application to export using your suggestion however when running the exported application I now lose the NativeProcess support. Any suggestions would be greatly appreciated.

  • geekreef

    I wish I would have found your post earlier. Eventually I stumbled upon this same process with FB4. Nice post. When I attempt to export my application I lose my NativeProcesses support. Any ideas?

  • yelloCub

    Is this possible to do with Eclipse using Flex Plugin? I tried to follow the steps on the adobe site and also tried to manually copy the files from 'air2_b2_sdk_mac_020210' to my sdk copy (no luck). I keep getting a message when I tell eclipse to use the SDK that it's not a Flex SDK. Anyone else? Maybe you just have to use Flex/Flash Builder standalone?

  • yelloCub

    Looks like I was able to use ditto in the terminal (as you describe above) to get eclipse to at least agree that my new sdk folder a flex sdk. ActionScript projects, unlike Flex Projects in eclipse don't have an Application.xml descriptor file. I am assuming I need to do something similar here since I still cannot import the new AIR2 classes. If someone else has any ideas, pass them along. Still pluggin away here.

  • yelloCub

    Update: showing how new I am to AIR. For others that don't know… the application.xml is generated when you render your AIR app. I love empty forums… it's like playing racket ball by yourself sometimes, but at least you get the ball back.

  • christoff

    thanks for the tips :)

  • yelloCub

    np. I still cannot get the SDK to work properly, however. For example, if I want to use the SecureSocket class, eclipse doesn't know where the class exists, so I have an error and I cannot code hint SecureSocket objects. If anyone has some ideas, pass them along. It might just be that the overlay only works for the Flex standalone (not the eclipse plugin).

  • cjw65

    Hi NativeProcess is a funny one .. if you declare
    private var process:NativeProcess and then with in your function you use

    process = new NativeProcess();
    then process.start(what ever nativeProcessStartupInfo);
    if you do not declare the private var .. it is unable find any other attribute than NativeProcess.IsSupported

    <mx:Script>
    <![CDATA[
    import mx.controls.Alert;

    import flash.desktop.NativeProcess;

    private var process:NativeProcess;

    public function init():void
    {
    if (NativeProcess.isSupported)
    {
    Alert.show(“Native Process is there “);

    var file:File = File.applicationDirectory;
    file = file.resolvePath(“NativeApps”);

    if ( Capabilities.os.toLowerCase().indexOf(“win”) > -1 )
    {
    file = file.resolvePath(“C:\testapp\note.cmd”);
    }

    var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
    nativeProcessStartupInfo.executable =file;

    process = new NativeProcess;
    process.start(nativeProcessStartupInfo);
    } else {
    Alert.show(“Native Process not avaiable “);
    }
    }

    ]]>
    </mx:Script>

    this works with air 2.0 beta 2 and flex 3.5

  • thetaytay

    Thanks! This was a big help. I have been looking for the ditto command for a long time, but didn't know what I was looking for! Thanks!

  • claire

    Hi,
    As far as I can tell I overlayed the files correctly.
    I have Flex 4.0.0.14159 and Air2Beta2

    My app builds but when I try to launch it in the IDE I get this:

    [SWF] myapp.swf – 5,842,270 bytes after decompression
    myapp v 0.1
    NativeProcess supported.
    ERROR: Unable to startup application
    [Unload SWF] myapp.swf

    Any ideas? Are my SDK files not right or could it be something else?

    Thanks

  • Bhavin

    superb man

    this MAC has ruined my mind…
    anyways
    how to run adt on MAC now ?

  • Bhavin

    superb man

    this MAC has ruined my mind…
    anyways
    how to run adt on MAC now ?