Bundling AIR 3 runtime in AIR desktop applications
At the beginning of this week a beta 2 version of the AIR 3 SDK was released. The AIR 3 SDK and AIR 3 runtime will be a major release that will bring a lot of really cool features. One of the features that I’m really excited about is Captive Runtime, which lets you package your applications with a bundled AIR runtime. This is something that was available for the iOS platform from day one, and now it is also supported for both Android devices and desktops.
I think this is a really important feature for AIR. I heard many times from our customers and the community that we need a solution that enables users to install AIR applications without administrator rights. This is a common scenario especially in the enterprise environments where users don’t have full privileges. Also in some other cases it may improve user experience as there is no need to ask the user to install an additional runtime. It will also help when you need to distribute your application on a CD or other media that doesn’t let you use the browser-based badge installer.
Now how do you package your app for both Windows and Mac? It’s really simple. First thing what you need to do is to download and unzip the new SDK from Adobe Labs. Next compile your application either with the command line mxmlc compiler or using Flash Builder. To do it in Flash Builder, right-click your AIR application project, select Export… -> Flash Builder -> Release Build, and complete just the first step of this wizard without finishing it. This will create a bin-release-temp folder under your project directory with a compiled SWF and app descriptor file. Now go to the command line and invoke following adt command from your project/bin-release-temp folder.
On Windows:
c:\path\to\air3sdk\bin\adt.bat -package -storetype pkcs12 -keystore c:\path\to\certificate.p12 -target bundle myapp.exe myapp-app.xml -C . myapp.swf
On Mac:
/path/to/air3sdk/bin/adt -package -storetype pkcs12 -keystore /path/to/certificate.p12 -target bundle myapp.app myapp-app.xml -C . myapp.swf
You will receive slightly different results depending on your platform. On Mac your application is packaged into myapp.app, which is a single Mac package file. You can just double-click it to run the app. Also if you want to introspect its content you can right-click it and select the Show Package Contents option. On Windows you will get myapp.exe folder that has all the runtime files and the executable myapp.exe file in it. Now you can use your favorite installer builder to build a setup package for your application.
Generated folders structure on Windows:
Generated package structure on Mac:
For Android options check out this blog post by my new fellow evangelist Andy Trice.




Does nobody use the Flash IDE any more? Most demos and examples I see at the moment seem to be aimed at Flash Builder or other dev-based IDEs. Just curious!
Chris Gannon
11 Aug 11 at 9:47 pm
@Chris Gannon
I know, right? I brought this up when Flex was first released and I attended the first ever Flex camp here in Toronto. I asked why all the new features came out in Flex first with Flash being added much much later on. The presenters denied that this was the case. Well, clearly it’s not!
The only thing I’ll say in defense of this strategy (if that’s what this is), is that, because the Flex SDK is open source and comes out first, it gives people time to test out all of these features before they’re bundles into the Flash IDE which, to me, is a much more polished product.
Of course, that’s just my guess. I’d still love to hear Adobe touch on this.
Patrick Bay
12 Aug 11 at 12:10 am
@Chris I still use Flash IDE, along with FDT, but I generally publish via Flash IDE.
It wouldn’t surprise me whether it was for marketing reasons. Flash CS5.0 never got the AIR2.7 upgrade however Flash CS5.5 did. Once AIR3.0 is officially released I wonder whether they will even push out an AIR3.0 update for Flash CS5.5 or whether they’ll make users wait/upgrade to CS6 for it?
Tim
12 Aug 11 at 2:42 am
@Chris sorry I’m a Flex guy I hardly every use Flash IDE
Piotr Walczyszyn
12 Aug 11 at 9:01 am
Coding in the Flash IDE is like going back to the stone age, and the debugger is craptastic.
I still use it, but just for managing assets, or quick spikes.
SHawn
12 Aug 11 at 5:34 pm
Hi Piotr, how does this relate to the native installer available in AIR 2 and your Native Application Updater? Are they still relevant and if yes in what situations would you choose to use which packaging/updating method?
Regards,
Yang
Yang
14 Aug 11 at 10:33 am
If AIR is bundled in .exe what are the consequences regarding file size? Does it increase and how much?
Milos
14 Aug 11 at 6:14 pm
[...] http://www.riaspace.com/2011/08/bundling-air-3-runtime-in-air-desktop-applications/ Share:Like this:LikeBe the first to like this post. [...]
Bundling AIR 3 runtime in AIR desktop applications « rksaran
18 Aug 11 at 6:57 am
@Piotr Walczyszyn
Does it mean that app still has to be installed? Or it could be run without installation (like flash projector)?
Pavel
18 Aug 11 at 9:54 am
@Pavel creating an installer is not obligatory, you can run it like in the flash projector.
Piotr Walczyszyn
18 Aug 11 at 2:49 pm
@Yang this additional option parallel to the native installer. Native Application Updater will not work with it because the package doesn’t have an installer. So you have to build installer and update mechanism yourself.
Piotr Walczyszyn
18 Aug 11 at 5:55 pm
Hi Piotr, I’d like to know how to turn the “myapp.exe” folder into a standalone projector file. Simply making an uncompressed ZIP and renaming the file extension to .exe doesn’t seem to do the trick.
Marcus
19 Aug 11 at 10:10 am
Does anyone else know the answer to my question? ; )
Marcus
26 Aug 11 at 11:18 am
@Marcus I don’t thing there is a way to make a projector-like with just a single file or at least I don’t know it.
For sure this is not supported out of the box with AIR SDK.
You can always package into an installer file with Inno Setup or equivalent…
p.
Piotr Walczyszyn
26 Aug 11 at 5:51 pm
Thanks for your reply, Piotr. I thought you could make a single executable of the Air application — would be a nice feature, I think.
Marcus
27 Aug 11 at 8:02 pm
Hi Piotr,
the AIR 3 SDK link
http://www.riaspace.com/2011/08/bundling-air-3-runtime-in-air-desktop-applications/labs.adobe.com/downloads/air3.html
is broken
Gaurav
13 Sep 11 at 3:49 pm
Hey!!
Have a couple of questions.
1. Does this mean that AIR will have cross platform support?
2. How will this affect the file size?
Pramod Rao
21 Sep 11 at 12:58 pm
@Pramod AIR already has cross platform support. This means you can include runtime together with your application installation package.
The file size of the application will increase, but you still have an option to use old ways with separate runtime (except iOS of course).
Piotr Walczyszyn
21 Sep 11 at 9:19 pm
Great post. Worked perfectly. Great tip BTW in regards to doing the 1st step of the export release build from Flash Builder and then dropping to the command line. I know the tooling will arrive in FB 2.6, but this is great.
I just did a simple Inno Setup test on a clean machine and it worked perfectly.
Shaun
Shaun Sullivan
24 Sep 11 at 6:05 pm
Is it now possible then to put desktop apps with captive runtime on MAC app store?
Harshad
13 Oct 11 at 10:30 pm
Harshad, did you find out anything about putting Captive Runtime apps into the Mac App Store?
William Grand
18 Oct 11 at 7:44 pm
I was suggested this website through my cousin. I am now not positive whether this post is written by way of him as no one else understand such designated approximately my difficulty. You are incredible! Thank you!
url shortener
29 Oct 11 at 5:31 am
I’ve got the following error while updating my Air 3.0 application packaged with the bunlde option :
An unexpected error occurred. Error# 16828
Here is my update.xml file :
4.2.1
http://myserver.com/update/MyApp-4.2.1.air
Update
Update
Any ideas ?
Cheers
Damien
Damien
10 Nov 11 at 6:24 pm
[...] If you just want to to enable your client to run an application without the need of admin rights, AIR 3.0 now offers the Captive Runtime which enables you to bundle your AIR App together with the AIR Runtime. Check this article to learn more about it: http://www.riaspace.com/2011/08/bundling-air-3-runtime-in-air-desktop-applications/ [...]
AIR Applications that can be updated without requiring admin rights | mabulous.net
18 Nov 11 at 11:46 am