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:

    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"

    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

No comments: