Using the AIR Debug Launcher (ADL)

Use the AIR Debug Launcher (ADL) to run both SWF-based and HTML-based applications during development. Using ADL, you can run an application without first packaging and installing it. By default, ADL uses a runtime included with the SDK, which means you do not have to install the runtime separately to use ADL.

ADL prints trace statements and run-time errors to the standard output, but does not support breakpoints or other debugging features. You can use the Flash Debugger (or an integrated development environment such as Flash Builder or Aptana Studio) for complex debugging issues.

Launching an application with ADL

To run an application with ADL, use the following pattern:

adl application.xml

Where application.xml is the application descriptor file for the application.

The full syntax for the ADL is:

adl [-runtime runtime-directory] [-pubid publisher-id] [-nodebug] [-profile profileName] application.xml [root-directory] [-- arguments]

-runtime runtime-directory Specifies the directory containing the runtime to use. If not specified, the runtime directory in the same SDK as the ADL program is used. If you move ADL out of its SDK folder, specify the runtime directory. On Windows and Linux, specify the directory containing the Adobe AIR directory. On Mac OS X, specify the directory containing Adobe AIR.framework.

-pubid publisher-id Assigns the specified value as the publisher ID of the AIR application for this run. Specifying a temporary publisher ID allows you to test features of an AIR application, such as communicating over a local connection, that use the publisher ID to help uniquely identify an application. As of AIR 1.5.3, you can also specify the publisher ID in the application descriptor file (and should not use this parameter).

Note: As of AIR 1.5.3, a Publisher ID is no longer automatically computed and assigned to an AIR application. You can specify a publisher ID when creating an update to an existing AIR application, but new applications do not need and should not specify a publisher ID.

-nodebug Turns off debugging support. If used, the application process cannot connect to the Flash debugger and dialogs for unhandled exceptions are suppressed. (However, trace statements still print to the console window.) Turning off debugging allows your application to run a little faster and also emulates the execution mode of an installed application more closely.

-atlogin Simulates launching the application at login. This flag allows you to test application logic that executes only when an application is set to launch when the user logs in. When -atlogin is used, the reason property of the InvokeEvent object dispatched to the application will be login instead of standard (unless the application is already running).

-profile profileName ADL debugs the application using the specified profile. The profileName can be desktop, extendedDesktop, mobileDevice, and extendedMobileDevice. For more information, see Limiting target application profiles and Application profiles.

application.xml The application descriptor file. See Setting AIR application properties. The application descriptor is the only parameter required by ADL and, in most cases, the only parameter needed.

root-directory Specifies the root directory of the application to run. If not specified, the directory containing the application descriptor file is used.

-- arguments Any character strings appearing after "--" are passed to the application as command line arguments.

Note: When you launch an AIR application that is already running, a new instance of that application is not started. Instead, an invoke event is dispatched to the running instance.

Printing trace statements

To print trace statements to the console used to run ADL, add trace statements to your code with the trace() function.

ActionScript example:

//ActionScript 
trace("debug message"); 

JavaScript example:

//JavaScript 
air.trace("debug message");
In JavaScript code, you can use the alert() and confirm() functions to display debugging messages from your application. In addition, the line numbers for syntax errors as well as any uncaught JavaScript exceptions are printed to the console.
Note: To use the air prefix shown in the JavaScript example, you must import the AIRAliases.js file into the page. This file is located inside the frameworks directory of the AIR SDK.

ADL Examples

Run an application in the current directory:

adl myApp-app.xml

Run an application in a subdirectory of the current directory:

adl source/myApp-app.xml release

Run an application and pass in two command-line arguments, "tick" and "tock":

adl myApp-app.xml -- tick tock

Run an application using a specific runtime:

adl -runtime /AIRSDK/runtime myApp-app.xml

Run an application without debugging support:

adl myApp-app.xml -nodebug

Run an application using Apache Ant to run the application:

<property name="SDK_HOME" value="C:/AIRSDK"/> 
<property name="ADL" value="${SDK_HOME}/bin/adl.exe"/> 
<property name="APP_DESCRIPTOR" value="$src/myApp-app.xml"/> 
 
<target name="test"> 
    <exec executable="${ADL}"> 
        <arg value="${APP_DESCRIPTOR}"/> 
    </exec>  
</target>

Connecting to the Flash Debugger (FDB)

To 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 dialog.)
  1. Start FDB. The FDB program can be found in the bin directory of the Flex SDK.

    The console displays the FDB prompt: <fdb>

  2. Execute the run command: <fdb>run [Enter]

  3. In a different command or shell console, start a debug version of your application:

    adl myApp.xml
  4. Using the FDB commands, set breakpoints as desired.

  5. 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, then the debugger only controls the execution of JavaScript code.

To run ADL without connecting to the debugger, include the -nodebug option:

adl myApp.xml -nodebug

For basic information on FDB commands, execute the help command:

<fdb>help [Enter]

For details on the FDB commands, see Using the command-line debugger commands in the Flex documentation.

ADL exit and error codes

The following table describes the exit codes printed by ADL:

Exit code

Description

0

Successful launch. ADL exits after the AIR application exits.

1

Successful invocation of an already running AIR application. ADL exits immediately.

2

Usage error. The arguments supplied to ADL are incorrect.

3

The runtime cannot be found.

4

The runtime cannot be started. Often, this occurs because the version specified in the application does not match the version of the runtime.

5

An error of unknown cause occurred.

6

The application descriptor file cannot be found.

7

The contents of the application descriptor are not valid. This error usually indicates that the XML is not well formed.

8

The main application content file (specified in the <content> element of the application descriptor file) cannot be found.

9

The main application content file is not a valid SWF or HTML file.

10

The application doesn’t support the profile specified with the -profile option.