Debugging a desktop AIR application
If you are developing your application with an IDE such
as Flash Builder, Flash Professional, or Dreamweaver, debugging
tools are normally built in. You can debug your application simply
be launching it in debug mode. If you are not using an IDE that
supports debugging directly, you can use the AIR Debug Launcher
(ADL) and the Flash Debugger (FDB) to assist in debugging your application.
Running an application with ADL
You can run an AIR application without packaging and installing
it using ADL. Pass the application descriptor file to ADL as a parameter
as shown in the following example (ActionScript code in the application
must be compiled first):
ADL prints trace statements, runtime exceptions, and HTML parsing
errors to the terminal window. If an FDB process is waiting for
an incoming connection, ADL will connect to the debugger.
You can also use ADL to debug an AIR application that uses native
extensions. For example:
adl -extdir extensionDirs myApplication-app.xml
Printing trace statements
To print trace statements to the console used to run ADL,
add trace statements to your code with the trace() function.
If your trace()
statements do not display
on the console, ensure that you have not specified ErrorReportingEnable
in the mm.cfg file. For
more information on the platform-specific location of this file, see Editing the mm.cfg file
to display debugging messages from your application. In addition,
exceptions are printed to the console.
Note: To use the air prefix
file into the page. This file is located inside the frameworks directory
of the AIR SDK.
Connecting to the Flash Debugger (FDB)
debug AIR applications with the Flash Debugger, start an FDB session
and then launch your application using ADL.
Note: In SWF-based AIR applications, the ActionScript source files
must be compiled with the -debug flag. (In Flash
Professional, check the Permit debugging option in the Publish Settings
Start FDB. The FDB program can be found in the bin directory
of the Flex SDK.
The console displays the FDB prompt: <fdb>
Execute the run command: <fdb>run [Enter]
In a different command or shell console, start a debug version
of your application:
Using the FDB commands, set breakpoints as desired.
Type: continue [Enter]
If an AIR application is SWF-based, the debugger only controls
the execution of ActionScript code. If the AIR application is HTML-based,
To run ADL without connecting to the debugger, include the -nodebug option:
For basic information on FDB commands, execute the help command:
For details on the FDB commands, see Using the command-line debugger commands in
the Flex documentation.