Rhys Causey
Rhys Causey

Reputation: 787

Compiling AIR application with Ant Task (WindowedApplication could not be found)

I'm trying to compile my AIR application with Ant, using the mxmlc Ant Task. It seems to compile fine, and I get a .swf, but when I try to run it with ADL, I get the message "Class mx.core::WindowedApplication could not be found." It looks like the AIR libraries aren't being included properly.

Here's my mxmlc task:

<mxmlc
     file="${MAIN_MXML}" 
     output="${DEPLOY_DIR}/MyApp.swf" 
     compatibility-version="3"
     locale="en_US"
     static-rsls="true"
     debug="${DEBUG_FLAG}"
     optimize="true"
     link-report="${DEPLOY_DIR}/report.xml"
     configname="air">
     <load-config filename="${FLEX_HOME}/frameworks/air-config.xml" /> 
     <library-path dir="${FLEX_HOME}/frameworks/libs" append="true">
          <include name="*.swc" />
     </library-path>
     <library-path dir="${FLEX_HOME}/frameworks/libs/air" append="true">
          <include name="*.swc" />
     </library-path>
     <library-path dir="${FLEX_HOME}/frameworks/locale" append="true">
          <include name="{locale}" />
     </library-path>
     <source-path path-element="${SRC_DIR}" />
</mxmlc>

Any idea why this is happening? I've tried not including the load-config section and not including the library paths, but it's always the same result - it can't find WindowedApplication.

Thanks!

Upvotes: 1

Views: 1990

Answers (1)

AntuanF1
AntuanF1

Reputation: 11

I´m not trying run with ADL, but i compile and Package it with ADL. Then i install the AIR application and it´s works.

Compilation

<mxmlc  file="${APP_ROOT}/${modulo}.mxml" keep-generated-actionscript="false" 
                        output="${APP_ROOT}/${modulo}.swf"
                        actionscript-file-encoding="UTF-8"                                          
                        incremental="false" warnings="false" fork="true" maxmemory="512m" >

                    <!-- Get default compiler options. -->                  
                    <load-config filename="${FLEX_HOME}/frameworks/air-config.xml"/>

                    <!-- List of path elements that form the roots of ActionScript
                    class hierarchies. -->
                    <source-path path-element="${FLEX_HOME}/frameworks"/>

                    <!-- List of SWC files or directories that contain SWC files. -->
                    <compiler.library-path dir="${APP_ROOT}" append="true">
                        <include name="libs" />
                     </compiler.library-path>       

                    <locale>es_ES</locale>


                    <!-- Necesario para el source path del Flex Build Paht-->
                    <compiler.source-path path-element='${APP_ROOT}'/>
                    <compiler.source-path path-element='${APP_ROOT}/locale/es_ES'/>

                    <use-network>true</use-network>
                    <debug>false</debug>
                    <optimize>true</optimize>

            </mxmlc>        

Packaging

<target name="packageModule">

          <echo message="Empaquetando ${modulo} como aplicación AIR...." />
          <exec dir="${DirectorioBase}" executable="${FLEX_HOME}/bin/adt.bat" spawn="false">

              <!--Empaqueta--> 
              <arg value="-package"/>

              <!--Formato del certificado -->
              <arg value="-storetype"/>         
              <arg value="pkcs12"/>

              <!--ruta donde está el certificado -->    
              <arg value="-keystore"/>          
              <arg value="./certificado/antuan.p12"/>

              <!--Password del certificado -->
              <arg value="-storepass"/> 
              <arg value="antuan"/>

              <!--Nombre del archivo AIR a generar -->
              <arg value="${modulo}.air"/>  
              <!--nombre del archivo xml de configuración -->
              <arg value="${modulo}-app.xml"/>           
              <!--Nombre del swf compilado -->
              <arg value="${modulo}.swf"/>

          </exec>

Upvotes: 1

Related Questions