0

I am making a Native Extension with AIR for Android, but i get the following error when launching the app: (no errors when compiling the .ane or the app)

[project name]\com.adobe.flexide.multiplatform.android.platform\zbar.ane is not a valid native extension file.

But i get this error only, when trying to run the app on my Android device AND there are ASDoc comments in the .ane. The project with ASDoc comments works perfectly when running on the simulator. The error exists when i compile with AIR 3.1 and with AIR 3.5 beta too.

Heres my ant buildfile:

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

Has anyone managed to build an .ANE for Android, that has built-in ASdoc?

sydd
  • 1,824
  • 2
  • 30
  • 54
  • I've a build script similar to yours and on Android it seems to work fine but i've some different problem on iOS: i got this error when installing the app which uses the documented extension Installation failed with error: Error Domain=NSCocoaErrorDomain Code=513 "“eu.alebianco.air.extensions.analytics.api.xml” couldn’t be copied because you don’t have permission to access “docs” were you able to solve your problem? it may help me with mine ... – alebianco Jan 02 '13 at 20:45
  • @cyberpunk Nope, i could not solve this problem. And havent seen any extension with working ASdoc either. – sydd Jan 03 '13 at 05:40

0 Answers0