Archive for June, 2011

If you have done any work with Flash, AIR and compiling for iOS devices (iPhone, iPad, etc) then you know that due to the AOT (Ahead Of Time) compilation, it can take a minute or more just to compile your application to an .ipa file. This can take up a lot of time during development. Adobe has been working on improving the workflow for mobile and with the introduction of AIR 2.7, they added a new -target option for ADT via the command line called “ipa-test-interpreter” mode. This produces a special .ipa file that instead of leveraging LLVM to do the AOT compilation, it simply packages up your .SWF as is, and the .ipa includes a runtime interpreter instead. This is much more like the way the AIR works on Android or on the desktop. In this case, its designed to reduce compilation time for development and testing only, its not for producing ad-hoc builds you would want to distribute to others, or your final deployment build. It is a bit slower in performance, but for testing and development, the time saved in compiling is totally worth it. It drops the compilation time down to almost zero, as it is compiling your .SWF as normal, and then marrying it up into a templated .IPA with the interpreter, as opposed to all the overhead of the normal AOT process. From the AIR documentation on this feature:

“ipa-test-interpreter — functionally equivalent to a test package, but compiles more quickly. However, the ActionScript bytecode is interpreted and not translated to machine code. As a result, code execution is slower in an interpreter package.”

Now you may be thinking great that is awesome, I’m going to start using it, where is it. Well the rub is that currently, it can only be used when invoking adt.jar from the command line to compile your .SWF file to an AIR based .ipa. There is no GUI option for it in Flash CS 5.5 yet. This is not a problem for a lot of folks using ANT, or Flash Builder, or those comfortable with the command line. However, if you are using Flash Professional CS 5.5, then given the lack of any GUI based control over this, you would have to publish your .swf file, switch to a terminal prompt or run some other script in order to invoke adt.jar with the proper -target option. If you’ve ever done development for iOS and know how many clicks are already involved in getting a new .ipa onto a device even when using Xcode or the iPhone Configuration Utility instead of iTunes to take some shortcuts, its still a lot of manual operations, add in switching out of Flash and invoking adt.jar manually, and it is way too much repetitive, annoying operations. A lazy developer is the best developer – be a lazy developer and make a tool to help you be even lazier.

I hate all that extra clicking around as much as the next guy, being a lazy developer, I decided there has to be a way to make this easier. Surely at some point Adobe will enhance Flash CS 5.5 to leverage this new feature directly in the IDE, but I wanted it now. So last night I put together a custom solution that replaces the AIR adt.jar with a shim adt.jar based on a teeny-tiny java class I hacked together, that accepts the arguments from Flash CS 5.5, adjusts the -target option to ipa-test-interpreter, and along with a custom Automator Workflow (containing some shell script, and Applescript) – decouples the process and allows you to publish your .ipa with this new fast interpreted mode. It even includes some nice Growl based notifications, opens the folder where the .ipa is compiled and opens the iPhone Configuration Utility for you automatically so you can just drag and drop your .ipa and get on with testing. Not only solved the problem, but added some bonus functionality. Sweet huh?

A nice side effect is that you can easily retain the log of your adt.jar compilation arguments to use them to create template scripts of common adt.jar scripts you might re-use later. Granted this is a hack, albeit a nice one, but it does have a dependency on Apples Automator, so its currently Mac OS X only. For you Windows folks, you might look into possibly using a classloader to invoke the real adt.jar Main Class entry directly from mine to allow it to work on Windows (that a whole other can of worms) and avoid the dependency on Automator. This wouldn’t allow the other bells and whistles, but it might be workable.

You can see a video of the workflow in action here where I am publishing an app I am working on with this method/code.
http://www.impossibilities.com/projects/custom_AIR_ADT/customADT.mp4

Download the source code and binaries for everything (at your own peril, it is provided “as-is”), along with detailed instructions and notes here:
http://www.impossibilities.com/projects/custom_AIR_ADT/customADT.zip

If anyone makes any nice improvements or additions, please drop me a note or post a comment here. Good luck and happy compiling!

Share
PRINT THIS ENTRY
3 Comments

Adobe AIR logoAdobe released Adobe AIR 2.7 this afternoon. It includes huge performance improvements for iOS devices, I’ve been working with it on several client applications recently, and it has allowed me to do things I simply wouldn’t have even tried with some previous versions of AIR for iOS, Adobe is really doing a great job improving the AIR runtime especially for mobile devices. In fact here is a link to an AIR 2.7 app I worked on as a contractor that just went live. The pending iOS release wouldn’t be possible without AIR 2.7.

Here is a recap of the top new features, and then a list of other good links discussing AIR 2.7 I’ve consolidated.

NEW FEATURES for MOBILE:

  • Enhanced rendering for iOS: AIR apps for iOS render up to 4x faster in CPU mode. This change will improve the performance of many AIR for iOS apps, including those built with the Flex framework. Watch the performance improvements
  • Video: Adobe AIR 2.7: Faster App Performance on iOS (Renaun Erickson, Adobe Flash Platform Evangelist, demonstrates faster AIR 2.7 app performance on iPad)
  • Faster development time for iOS applications: Developers can now debug and build iOS applications faster than with previous versions using a new mode available within the AIR Developer Tool (ADT). During the development of an application, developers can now choose to use “interpreter mode” to streamline the testing and debugging development cycle.
  • AIR installation on SD cards for Android devices: This feature allows end users to install or move the AIR runtime onto the SD cards within their Android devices so they can free up storage space on the phone.

NEW FEATURES for DESKTOP:

  • Integrated support for Media Measurement: The Adobe AIR 2.7 runtime now includes the same built-in support for media measurement as Adobe Flash Player 10.3, allowing companies to simplify the collection of real-time, aggregated reporting data for how content is distributed and viewed by users. With direct support for Adobe SiteCatalyst, powered by Omniture, developers can implement video analytics for existing or legacy video players with as little as two lines of code. For additional information, see the article on measuring video consumption in Flash.
  • Acoustic echo cancellation: With integrated support for acoustic echo cancellation, developers can now add real-time VoIP capabilities to games, enterprise, and other types of applications without requiring users to wear a noise-canceling headset. Users can now chat using the speaker built into their desktop or laptop computer. This new capability is also available in Flash Player 10.3.
  • Navigation Improvements for HTML Content: Enables seamless weblink-style navigation within desktop apps such as magazine viewers and ebook readers. Developers can now respond to a new event to be notified when content within the HTMLLoader control attempts to change the location of a page. This enhancement provides developers with a better way to implement intra-application navigation.

For additional feature and release details please read the AIR 2.7 developer release notes.

Collected Links about AIR 2.7:

Get the AIR 2.7 Runtime
AIR 2.7 developer release notes
Get the AIR 2.7 SDK
Paul Trani covers the new features of AIR 2.7
Flash Player Runtime Blog discusses AIR 2.7
Flash Player Team announces AIR 2.7
Lee Brimelow covers AIR 2.7

UPDATE: 06/16 – More info and the future of AIR for Linux:

I’ve had a couple commenters ask about support for AIR 2.7 for Flash Builder and its been noted by many that, this month, Flash Builder 4.5 will get an update to enable support for AIR 2.7 and PlayBook will receive an update OTA of AIR 2.7 by the end of June. Also the 2.7 SDK is easy to install for Flash Professional CS 5.5 – its as simple as unzipping the SDK, and drop the folder into the Flash Professional CS 5.5 application folder and rename it “AIR2.6”. There are actually a few more steps to fully install – for the full list of steps visit this link.

I’ve added some thoughts, and links about the future of AIR for Linux that didn’t get as much coverage originally. Including a good read from Oliver Goldman that provides a broader view of what the teams have been doing with AIR and mobile the last few years and some good info from Dave McAllister on the logic behind some of their decision making. I’ve already seen plenty of articles and developers (both for and against AIR) publicly and privately crying foul about Linux as a second class citizen, and a loss of trust with Adobe now, lack of insight to their roadmap – the whole gamut of concerns about the decisions around AIR on Linux. I don’t see it as black and white as many other do. In fact, I think it will be a good thing, which I’ll explain in a moment. First though, I hate to see that important information about the decisions are not being highlighted in many of the articles I am seeing, like this article on Electronista.com fails to point out one of the biggest take aways from Dave’s article and Adobes FAQ on AIR on Linux, is that its not been 100% sidelined but that instead they have shifted their resources to providing OSP Partners (OSP is Adobe’s Open Screen Project), like Google, Intel, RIM, Nvidia, ARM, Nokia, HTC, Comcast, LG, Mips, Motorola, Cisco, etc. (full list here) a Linux porting kit for AIR (including source code), so that if they choose to do so, they can implement their own vetted and approved versions of AIR for PC’s, mobile devices, TV’s and TV-connected devices like set top boxes and other consumer devices. More info on the porting kit and announcement about the strategy can be found here.

I posted a comment to that effect in a few places, like at that Electronista article pointing out that info, as it seems like they left out a critical take away that would have made for a much more informative and complete article instead of what, when seeing that bit left out, makes the authors of the articles at the least, less informed and not very thorough in their reporting and merely regurgitating without any critical thought, to at the worst jumping on the bandwagon of Flash bashers simply for the sake of driving page counts. I especially feel it is an important take away and to paraphrase Dave McAllister and Mark Hopper, by shifting Adobes focus to the porting kit and support of partner implementations, Adobe expects to provide broader support for AIR across Linux-based PCs and devices, whereas their own desktop Linux releases have accounted for less than 0.5% of lifetime AIR downloads. A good look at what RIM and Adobe have done for the Blackberry Playbook and it support of Flash in the browser on the device and as one of its options for native applications (albeit for QNX and not Linux proper) should serve as a good idea for what kind of fruit this shift in focus could bear. Its also worth pointing out that back in the Macromedia days, this was a similar model to how Flash Lite and custom variants of Flash for whole device UI’s worked – OEMs would license the source and work with Macromedia and a some select partners to make their own custom implementations. Palm, Sony, Nokia, Samsung, Kodak and others come to mind. I feel that the big push we have seen and performance improvements in AIR for iOS, Android and the Playbook, combined with this shift we will actually see more Flash/AIR on Linux in the future as opposed to if Adobe has been the sole driver/enabler/maintainer going forward. This is just my opinion, but I’ve been watching Flash evolve for almost 15 years now, and I’ve seen things that have floundered and flopped, and directions that didn’t work, but I feel the decisions behind this one are sound, and that it will be for the best long term.

Here are some additional links about AIR and Linux:

Share
PRINT THIS ENTRY
3 Comments