Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/apache-flex/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache flex 使用带有本机扩展的ant mxmlc任务_Apache Flex_Air_Mxmlc - Fatal编程技术网

Apache flex 使用带有本机扩展的ant mxmlc任务

Apache flex 使用带有本机扩展的ant mxmlc任务,apache-flex,air,mxmlc,Apache Flex,Air,Mxmlc,我有一个AIR应用程序,我正在编译成mobile。有一个iOS本机扩展()在IDE中使用时可以很好地编译 然而,IDE还不够,因为我们正在转向支持其他平台,我决定构建一个Ant脚本来运行构建过程 问题是这个特定的ANE似乎在扩展代码中定义了MobileBackup类,而不是像我正在使用的其他ANE一样在一个单独的.as文件中 下面是我看到的错误: [mxmlc] Loading configuration file /Users/anderson/src/flex/4.6.0/framework

我有一个AIR应用程序,我正在编译成mobile。有一个iOS本机扩展()在IDE中使用时可以很好地编译

然而,IDE还不够,因为我们正在转向支持其他平台,我决定构建一个Ant脚本来运行构建过程

问题是这个特定的ANE似乎在扩展代码中定义了MobileBackup类,而不是像我正在使用的其他ANE一样在一个单独的.as文件中

下面是我看到的错误:

[mxmlc] Loading configuration file /Users/anderson/src/flex/4.6.0/frameworks/airmobile-config.xml
[mxmlc] /Users/anderson/src/xxx/src/xxx/Utility.as(32): col: 35 Error: Type was not found or was not a compile-time constant: MobileBackup.
[mxmlc] 
[mxmlc]         private static var mobileBackup:MobileBackup = new MobileBackup();
[mxmlc]                                         ^
[mxmlc] 
[mxmlc] /Users/anderson/src/xxx/src/xxx/Utility.as(32): col: 54 Error: Call to a possibly undefined method MobileBackup.
[mxmlc] 
[mxmlc]         private static var mobileBackup:MobileBackup = new MobileBackup();
[mxmlc]                                                            ^
[mxmlc] 
[mxmlc] /Users/anderson/src/xxx/src/xxx/Utility.as(32): col: 54 Error: Call to a possibly undefined method MobileBackup.
[mxmlc] 
[mxmlc]         private static var mobileBackup:MobileBackup = new MobileBackup();
[mxmlc]                                                            ^
[mxmlc] 
[mxmlc] /Users/anderson/src/xxx/src/xxx/Utility.as(21): col: 35 Error: Definition ie.jampot.nativeExtensions:MobileBackup could not be found.
[mxmlc] 
[mxmlc]     import ie.jampot.nativeExtensions.MobileBackup;
mxmlc调用如下所示:

<mxmlc 
   file="${app.main.class.file}" 
   output="${build.output.swf.file}" 
   locale="${LOCALE}" 
   static-rsls="false" 
   accessible="false" 
   configname="airmobile" 
   debug="${build.debug.mode}" 
   failonerror="true" 
   fork="true" 
   maxmemory="512m">
  <source-path path-element="${app.src.path}"/>
  <compiler.library-path dir="${FLEX_HOME}/frameworks" append="true">
<include name="libs/*" />
  </compiler.library-path>
  <library-path file="${FLEX_HOME}/frameworks/locale/${LOCALE}" append="true"/>
  <library-path dir="${spicelib.lib.path}" includes="*.swc" append="true"/>
  <library-path dir="${parsley.lib.path}" includes="*.swc" append="true"/>
  <library-path dir="${app.lib.path}" includes="*.swc" append="true"/>
  <external-library-path file="${AIR_GLOBAL}" append="true"/>
  <external-library-path dir="${app.ane.path}" includes="*.ane" append="true"/>
  <define name="CONFIG::DESKTOP" value="${output.config.environment.desktop}"/>
  <define name="CONFIG::IOS" value="${output.config.environment.ios}"/>
  <define name="CONFIG::ANDROID" value="${output.config.environment.android}"/>
  <define name="CONFIG::PRODUCTION" value="${output.config.environment.production}"/>
  <define name="CONFIG::STAGING" value="${output.config.environment.staging}"/>
  <define name="CONFIG::LOCAL" value="${output.config.environment.local}"/>
</mxmlc>

其中app.ane.path是指向项目的.ane文件集合的路径

我还尝试使用库路径而不是外部库路径

除了添加build.xml之外,我根本没有更改FlashBuilder项目的布局或内容,它在IDE中仍然可以很好地编译


我需要做些什么才能让它在IDE之外编译?

我把这些都打好了,决定在发布之前再做一次尝试。我知道了,所以我会把结果贴在这里给其他人看


Flash Builder必须将SWC从ANEs中拉出,以供mxmlc使用。我在其他地方找到了SWC的副本,并将其添加到我的libs文件夹中,嘿,presto,它可以工作。

我无法解释原因,但如果你复制并重命名.ane文件并将其更改为.SWC文件(字面上是复制并重命名,无需转换),然后将ane的目录作为外部库路径引用,它就可以工作了

<compiler.external-library-path dir="${ANE_DIR}" includes="*.swc" append="true" />

我直接使用java任务

当我将一个电子文件的绝对路径附加到
-library path
选项(别名
-l
)时,它就起作用了

<compiler.external-library-path dir="${ANE_DIR}" includes="*.swc" append="true" />
但是,它不能在mxmlc任务中工作

<java jar="${FLEX_HOME}/lib/mxmlc.jar" fork="true" failonerror="true" dir="${FLEX_HOME}/frameworks">
<arg value="-o=${basedir}/${swf.file}"/>
<arg value="-load-config=airmobile-config.xml"/>
<arg value="-l+=${basedir}/${LIB_DIR}"/>
<arg value="-l+=${basedir}/${ANE_DIR}/us.sanguo.ios.ane" />
<arg value="-debug=false"/>
<arg value="-optimize=false"/>
<arg value="${basedir}/${main.file}"/>
</java>


我查看了mxmlc Ant任务的源代码,它明确地忽略了任何不是*.swc的文件。我在github上分叉了apache/flex sdk,并修复了它,因此mxmlc接受*.swc和*.ane。您可以在处克隆固定版本(要构建固定ant任务jar,请转到modules/antTasks并运行ant)。

正如其他人所发布的,mxmlc将忽略除*.swc以外的任何文件扩展名进行链接。我通过将所有.ane文件复制到一个临时目录,将它们命名为.swc,然后调用mxmlc来解决这个问题:

<!-- Copy all ANE files to temp SWC files because mxmlc only accepts SWC for linkage -->
<copy todir="${basedir}/temp-swc" overwrite="true">
    <fileset dir="${basedir}/_extensions"/>
    <globmapper from="*.ane" to="*.swc"/>
</copy>

<mxmlc
    <!-- ... --> >

    <!-- ... -->

    <external-library-path dir="${basedir}/temp-swc" includes="*.swc" append="true"/>
</mxmlc>

<!-- Remove temporary SWC files after usage -->
<delete dir="${basedir}/temp-swc" />

我试图编译错误时遇到以下错误:无法访问JARD文件:\server\sdk\u fb\flex sdk\bin\\..\lib\mxmlc.jar这是我的命令