Cross Column

Showing posts with label Adobe AIR. Show all posts
Showing posts with label Adobe AIR. Show all posts

Wednesday, January 28, 2009

Not All Files Appear in AIR Export Release Build

As shown in Adobe bug database (i.e., FB-16266), not all files you need will appear in AIR Export Release Build.

I've found that there are two cases that files were not copied over:
  1. Image file included using the following MXML statement:
    <mx :Image source="assets/search/oracle_logo.png">

  2. Dynamically loaded resource bundle files:

    _resourceModuleURL = "assets/search/search_" + _locale + ".swf";
    _step = new ResourceBundleLoader(_resourceModuleURL);


FlexBuilder should have provided options for developers to pick and choose what files to be packaged into the final AIR application. It does. However, in my case, the above two files are simply not listed in "AIR File Contents" dialog and there is no way to choose them from.

The workaround for this issue is:
  1. At the last step of "Export Release Build" (i.e., AIR File Contents), click on Cancel instead of Finish. FlexBuilder will copy all files needed (except the ones that are known missing) to the bin-release folder.
  2. Copy missing files to their corresponding locations.
  3. Run adt manually to generate the final AIR application:

    REM
    set flexSdkDir="D:\Program Files\Adobe\Flex Builder 3\sdks\3.1.0"
    set JAVA_HOME="C:\Program Files\Java\jre1.6.0_07\bin"

    REM
    set Path=%Path%;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
    set Path=%Path%;c:\Program Files\Winzip;D:\MKSNT;%flexSdkDir%\bin
    set Path=%Path%;%JAVA_HOME%\bin
    echo %Path%

    set flexWorkDir="D:\myDocuments\Flex Builder 3"

    adt -package -storetype pkcs12
    -keystore %flexWorkDir%/myDigitalCertificate.p12
    -storepass welcome -tsa none Search.air bin-release\Search-app.xml
    -C bin-release Search.swf -C src assets


Monday, January 12, 2009

Tools for Debugging AIR Applications


Tools Descriptions
Flex Builder Debugger
  • Free videos about debugging with Flex Builder are available from Lynda.com.
  • With the <mx:TraceTarget/> tag present any where in the code which enables the tracing information, you can use the debugger version of Flash Player to track network traffic between your client and application server.
  • Further information about the Adobe Flex Builder debugger can be found here.

ADL (AIR Debug Launcher)

  • If you do not use Flex Builder 3 or your AIR application are not Flex-based, you can use ADL provided in AIR SDK.
  • With the ADL, you can debug either Flex-based or HTML-based applications.

Third-party Tools (ServiceCapture, Charles, and Ethereal/Wireshark)
  • Allow you to capture the network traffic (using Flash Remoting) or data flow between an AIR application and any server technologies.

AIR HTML Introspector
  • AIRIntrospector.js JavaScript file provided in the AIR SDK can be included in your application to help debug HTML-based or AJAX-based AIR applications.
  • You can download Aptana Studio to create/debug HTML/JavaScript based AIR Applications.
  • Include the AIRIntrospector.js file only when developing and debugging the applications. But, remove it in the packaged Adobe AIR application that you distribute.


Monday, December 8, 2008

Debugging Tips for Air Applications in Flex

When you run (or debug) either your own or other people provided Air applications, sometimes it won't start even you click the Run (or Debug) icon in FlexBuilder. Here lists three scenarios and their possible solutions in the following table:


Possible Cause

Possible Solution

Wrong AIR runtime version specified in the xmlns attribute of application property in the application descriptor file.

Change
<application xmlns="http://ns.adobe.com/air/application/1.1">

to
<application xmlns="http://ns.adobe.com/air/application/1.0">

if you're running AIR 1.0 runtime instead of 1.1.

This could happen when you're running other people provided application and your Flex Builder version is different from his/hers or you've updated your Flex Builder to a newer version.


The error message should be "Invalid application descriptor: descriptor does not match runtime version." or "error while loading initial content" when you debug it.

A zombie adl.exe prevents AIR application from running.

Bring up Task Manager and if there is a zombie process called adl.exe (i.e., AIR Debug Launcher), kill it. This can be helpful if Flex complains that it cannot connect to the debug process.
Sometimes, you also need to restart FlexBuilder to fix it.
Caching Problem Go to your application descriptor file and bump up your version number. I found out that this can be helpful sometimes.


If the above solutions don't apply to your own situation, the last resort is to examine Eclipse Error Log file (i.e., ".log"). This file stores messages from the Eclipse environment. The default location of this log file on Windows XP is c:\Documents and Settings\user_name\workspace\.metadata\.log.

For MacOS and Linux, the default location is also in the workspace directory, but files and directories that begin with a dot are hidden by default. As a result, you must make those files visible before you can view the log file.

One of the possible causes described above is related to the incompatible tech stack versions. Therefore, it's essential for you to know what compile/linkage/runtime environment your AIR application is compiled/linked/run against. To figure out these version information, here we list where or how to find them:


Version Information

Where to Find

Flex Builder

Read from "Add or Remove Programs" or "About Adobe Flex Player..."

Adobe AIR runtime

Read from "Add or Remove Programs."
Adobe Flash Player ActiveX

Read from "Add or Remove Programs."
Required AIR runtime version for AIR application to run

Read the xmlns attribute of application property in the application descriptor file.

Minimum player version that will run the compiled AIR application Read the target-player value from global Flex configuration file air-config.xml. The default location of this log file on Windows XP is C:\Program Files\Adobe\Flex Builder 3\sdks\3.1.0\frameworks\.
Which SDK to link with for the AIR application

Read default Flex SDK from Installed Flex SDKs (i.e., Window > Preferences > Flex > Installed Flex SDKs).

Note that it's possible to target different Flash players (i.e., either Player 9 or Player 10) with the same SDK.  See Targeting Flash Player 10  for  details.



After you resolve all setup issues, you should be able to run debugger. AIR supports debugging directly, so you do not need a debug version of the runtime (as you would with Adobe® Flash® Player). To conduct debugging in Flex, see Debugging Flex Applications authored by Mike Morearty.

© Travel for Life Guide. All Rights Reserved.

Analytical Insights on Health, Culture, and Security.