Developing Android Applications with Adobe AIR [8]
Using Flash Professional
To test and debug in Flash Professional, follow these steps:
Select File→AIR Android settings.
Under the Deployment tab, for “Android deployment type”, choose Debug (see Figure 2-3).
Start a debug session by selecting Debug→Begin Remote Debug Session→ActionScript 3.0. Launch the application on the device.
If you are debugging using WiFi, when you are prompted for a hostname or IP address, enter it. On Windows, you can obtain this information by typing ipconfig at the command prompt. On the Mac, click on the WiFi icon and select Open Network Preferences; if you are using the Terminal window, type ifconfig and look for the address at the beginning of the line starting with “inet”.
When the session starts, you should see “Waiting for Player to connect...”
Now launch your application. You should see “Remote Flash Player: app:/first.swf”.
Figure 2-3. The Deployment tab of AIR for Android Settings on Flash Professional
Using Flash Builder
To test and debug in Flash Builder, click the Debug button at the top of the screen. When you click on the button you should see the trace statements in your Console window (see Figure 2-4).
Figure 2-4. The Debug Settings option in Flash Builder
In addition to traces in the output window, you get breakpoint control, the ability to step through code, and variable monitoring.
WARNING
There is a known issue with debugging not working the first time after installation on the device. Force-stop your application on the device and launch it again. This bug should be fixed in a future release.
Mobile Utility Applications
Several mobile utility applications are available for AIR developers.
Launchpad
As its name indicates, this Adobe Labs beta tool gives Flex developers a head start in creating AIR desktop and mobile applications. Launchpad is an AIR application that generates a complete Flex project that is ready to import to Flash Builder.
The process consists of four steps. The Settings option is for the application descriptor and permissions. The Configuration option is for setting up listeners of various events, such as the application moving to the background. The Samples option is for importing sample code for the APIs, such as Geolocation or Microphone. The Generate option creates a ZIP file at the location of your choice, ready to be imported. Sample icons and assets are automatically included based on your selection.
For more information on Launchpad, go to http://labs.adobe.com/technologies/airlaunchpad/.
Device Central CS5
Adobe Device Central is not available for AIR development. At the time of this writing, it is targeted at Flash Player development only. It provides useful tools such as accelerometer simulation that can otherwise only be tested on the device. ADL provides some, albeit more limited, functionality. It can simulate soft keys and device rotation.
Package Assistant Pro
Serge Jespers, from Adobe, wrote an AIR application that facilitates the packaging of AIR applications for Android. You can download the Mac OS X and Windows versions from http://www.webkitchen.be/package-assistant-pro/. Note that you need the .swf file, the application descriptor file, and the code-signing certificate.
The packager preferences store the location of the AIR SDK adt.jar (located in AIRsdk/lib/) and your code-signing certificate. The packaging process consists of a few easy steps, all accomplished via a user interface. Browse to select the required files, enter your certificate password, and choose a name for the APK file. You can choose to compile a device release or a debug version.
This tool is convenient if you use one of the tools we will discuss next, and is a nice GUI alternative to using the command-line tool.
De MonsterDebugger
De MonsterDebugger is an open source debugger for Flash, Flex, and AIR.