0

我正在使用 AIR for Android 制作本机扩展,但在启动应用程序时出现以下错误:(编译 .ane 或应用程序时没有错误)

[项目名称]\com.adobe.flexide.multiplatform.android.platform\zbar.ane 不是有效的本机扩展文件。

但我仅在尝试在我的 Android 设备上运行该应用程序并且 .ane 中有 ASDoc 注释时收到此错误。带有 ASDoc 注释的项目在模拟器上运行时可以完美运行。当我使用 AIR 3.1 和 AIR 3.5 beta 进行编译时,错误仍然存​​在。

这是我的蚂蚁构建文件:

<project name="test" default="build-all" basedir=".">
<property name="FLEX_HOME" value="C:\Program Files (x86)\Adobe\Adobe Flash Builder 4.6\sdks\4.6.0+AIR35beta" />
<property name="BUILDDIR" value="./builddir" />
<property name="BASEDIR" value="." />

<taskdef name="compc" classname="flex.ant.CompcTask" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />
<taskdef name="asdoc" classname="flex.ant.AsDocTask" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />

<target name="compile-flex" description="Compile AndroidCameraANE.swc">
    <compc output="${BUILDDIR}/AndroidCameraANE.swc" locale="en_US"
           optimize="true" strict="true" as3="true" warnings="true"
           static-link-runtime-shared-libraries="true">
        <load-config filename="${FLEX_HOME}/frameworks/air-config.xml"/>
        <source-path path-element="${BASEDIR}/actionscript/src"/>
        <include-sources dir="${BASEDIR}/actionscript/src" includes="*"/>
    </compc>
</target>

<target name="copy-files" description="copy Java, Flex, extension.xml files to the build dir" >
    <copy todir="${BUILDDIR}/android/libs/armeabi">
        <fileset dir="${BASEDIR}/java/libs/armeabi" />
    </copy>

    <copy todir="${BUILDDIR}/android/libs/armeabi-v7a">
        <fileset dir="${BASEDIR}/java/libs/armeabi-v7a" />
    </copy>

    <copy todir="${BUILDDIR}/android/libs/x86">
        <fileset dir="${BASEDIR}/java/libs/x86" />
    </copy>

    <copy file="${BASEDIR}/java/bin/zbarane.jar" todir="${BUILDDIR}/android/"/>

    <copy file="${BASEDIR}/actionscript/extension.xml" todir="${BUILDDIR}/"/>
</target>

<target name="unzipAndroidANE" description="unzip library.swf from AndroidCameraANE.swc" >
    <unzip src="${BUILDDIR}/AndroidCameraANE.swc" dest="${BUILDDIR}/android">
        <patternset><include name="library.swf"/></patternset>
    </unzip>
    <unzip src="${BUILDDIR}/AndroidCameraANE.swc" dest="${BUILDDIR}/default">
        <patternset><include name="library.swf"/></patternset>
    </unzip>
</target>

<target name="build-ane" >
    <exec executable="${FLEX_HOME}/bin/adt.bat" failonerror="true" dir="${BUILDDIR}">
        <arg line="-package -target ane zbar.ane extension.xml -swc AndroidCameraANE.swc -platform Android-ARM -C android . -platform default -C default ."/>
     </exec>
</target>

<target name="doc" description="updates ane with asdoc. On Android it generates invalid ane file!">
    <asdoc output="${BUILDDIR}/tempDoc" lenient="true" failonerror="true" 
            keep-xml="true" skip-xsl="true" fork="true">
        <load-config filename="${FLEX_HOME}/frameworks/air-config.xml"/>
        <doc-sources path-element="${BASEDIR}/actionscript/src/com/blogspot/visualscripts/zbar/Zbar.as"/> 
    </asdoc>
    <zip destfile="${BUILDDIR}/zbar.ane" update="true">
        <zipfileset dir="${BUILDDIR}/tempDoc/tempdita" prefix="docs">
            <include name="*.*"/>
            <exclude name="ASDoc_Config.xml"/>
            <exclude name="overviews.xml"/>
        </zipfileset>
    </zip>
</target>
<!-- build order is important -->
<target name="build-all">
    <delete dir="${BUILDDIR}" />
    <antcall target="compile-flex" />
    <antcall target="copy-files" />
    <antcall target="unzipAndroidANE" />
    <antcall target="build-ane" />
    <antcall target="doc" />  <!--Makes invalid file on Android! -->
    <delete includeEmptyDirs="true">  
        <fileset dir="${BUILDDIR}">  
            <include name="*/**" />
            <exclude name="zbar.ane" /> 
        </fileset>  
    </delete>
</target>
</project>

有没有人设法为 Android 构建了一个内置 ASdoc 的 .ANE?

4

0 回答 0