本文介绍了使用 Ant Task 编译 AIR 应用程序(找不到 WindowedApplication)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 mxmlc Ant Task 使用 Ant 编译我的 AIR 应用程序.它似乎编译得很好,我得到了一个 .swf,但是当我尝试使用 ADL 运行它时,我收到消息找不到类 mx.core::WindowedApplication".AIR 库似乎未正确包含.

这是我的 mxmlc 任务:

<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>

知道为什么会这样吗?我试过不包括 load-config 部分,也不包括库路径,但结果总是相同 - 它找不到 WindowedApplication.

谢谢!

解决方案

我没有尝试使用 ADL 运行,而是使用 ADL 编译和打包它.然后我安装了 AIR 应用程序,它可以工作了.

编译

<mxmlc file="${APP_ROOT}/${modulo}.mxml" keep-generated-actionscript="false"output="${APP_ROOT}/${modulo}.swf"actionscript-file-encoding="UTF-8"增量=假"警告=假"叉=真"maxmemory=512m"><!-- 获取默认编译器选项.--><load-config filename="${FLEX_HOME}/frameworks/air-config.xml"/><!-- 构成 ActionScript 根的路径元素列表类层次结构.--><source-path path-element="${FLEX_HOME}/frameworks"/><!-- SWC 文件或包含 SWC 文件的目录的列表.--><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><优化>真</优化></mxmlc>

包装

<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 generic--><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>

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!

解决方案

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>

这篇关于使用 Ant Task 编译 AIR 应用程序(找不到 WindowedApplication)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 11:15