Stack traces in AIR Release Builds

If you’ve ever noticed your AIR app release build acting a bit odd, chances are you’ve caused a fatal error. You could try adding Global Error Handling support to your app to try and catch these uncaught errors, but unfortunately global error handling is pretty useless when trying to identify bugs in your AIR release build. Firsty, it will only catch errors from components on the stage which leaves everything else within your app free to fail silently, (mediators, commands, utility classes etc). Secondly, even if you do catch an error from the stage you’ll only be presented with a nondescript one liner with no access to the stack trace.

“Surely I can add -debug=true to my command line options when compiling?” Nope, this argument gets stripped when compiling your release build. Here’s a great little trick discovered by TayTay to allow you to see full stack traces in the debug error alert, just as you would with your debug version:

    Open your AIR application installation folder. (Mac: Right-click -> Show Package Contents) 

    Navigate to the Resources/META-INF/AIR folder

    Create a new file in this folder named ‘debug’. It just needs to be an empty file, no file extension. (I usually create a txt file and remove the file extension).

    Fire up your app and you will now get full Stack Trace alerts just as you would with your debug app.

Got something to say? Go for it!

Spam Protection by WP-SpamFree