Skip to main content
Inspiring
December 20, 2012
Question

Packaging AIR application with ant fails, Packaging AIR application inside IntelliJ works

  • December 20, 2012
  • 1 reply
  • 1535 views

Hi,

I can package AIR application (package type ad-hoc distribution) inside IntelliJ (from Build menu)

but when I try with my ant build, it encounters an error running the adt command

Is there a way to have more details on the error? At the moment, it's just a Java returned:2 error.

I've copied my ant config files below.

Any ideas anyone on where the problem could lie or how to debug it?

THANKS!

Note: I have no issue with the package debug target, be it via IntelliJ or my ant build.

Build.xml

<project name="headr" default="package-application-debug-interpreter" basedir="../">

          <property file="build/build.properties" />

          <property name="FLEX_HOME" value="${flexsdk.dir}" />

          <taskdef resource="flexTasks.tasks" classpath="${flexsdk.dir}/ant/lib/flexTasks.jar" />

          <target name="clean" description="deletes everything in build folder">

                    <echo message="Removing build directory contents..." />

                    <delete includeemptydirs="true" quiet="false">

                              <fileset dir="${build.dir}" />

                    </delete>

          </target>

          <target name="perform-file-copy">

                    <mkdir dir="${build.dir}" />

                    <echo message="Copy files to output dir: ${build.dir}" />

                    <copy file="src/HeadrApplication-app.xml" todir="${build.dir}" />

                    <replace file="${build.dir}/HeadrApplication-app.xml" token="[This value will be overwritten by Flash Builder in the output app.xml]" value="out/HeadrApplication.swf" />

          </target>

          <target name="compile" depends="clean,perform-file-copy">

                    <mxmlc file="src/HeadrApplication.as" output="${build.dir}/HeadrApplication.swf" locale="en_US" accessible="false" actionscript-file-encoding="UTF-8" static-rsls="true" configname="airmobile" debug="${debug}" failonerror="true" maxmemory="1024m" fork="true" swf-version="17">

                              <load-config filename="${flex_config}" append="true" />

                    </mxmlc>

          </target>

          <target name="pack-application" depends="compile">

                    <java jar="${adt.jar}" fork="true" failonerror="true">

                              <arg value="-package" />

                              <arg value="-target" />

                              <arg value="${target}" />

                              <arg value="-provisioning-profile" />

                              <arg value="${provisioning-profile}" />

                              <arg value="-storetype" />

                              <arg value="pkcs12" />

                              <arg value="-keystore" />

                              <arg value="${keystore}" />

                              <arg value="-storepass" />

                              <arg value="${storepass}" />

  <arg value="-extdir" />

  <arg value="ane/" />

                              <arg value="${build.dir}/HeadrApplication.ipa" />

                              <arg value="${build.dir}/HeadrApplication-app.xml" />

                              <arg value="${build.dir}/HeadrApplication.swf" />

                              <arg value="-C" />

                              <arg value="src/" />

                              <arg value="Default.png" />

  <arg value="-C" />

  <arg value="src/" />

  <arg value="Default-568h@2x.png" />

                              <arg value="-C" />

                              <arg value="src/" />

                              <arg value="icons/." />

                              <arg value="data/." />

                    </java>

          </target>

          <target name="pack-application-debug" depends="compile">

                    <java jar="${adt.jar}" fork="true" failonerror="true">

                              <arg value="-package" />

                              <arg value="-target" />

                              <arg value="${target}" />

                              <arg value="-connect" />

                              <arg value="-provisioning-profile" />

                              <arg value="${provisioning-profile}" />

                              <arg value="-storetype" />

                              <arg value="pkcs12" />

                              <arg value="-keystore" />

                              <arg value="${keystore}" />

                              <arg value="-storepass" />

                              <arg value="${storepass}" />

  <arg value="-extdir" />

  <arg value="ane/" />

                              <arg value="${build.dir}/HeadrApplication.ipa" />

                              <arg value="${build.dir}/HeadrApplication-app.xml" />

                              <arg value="${build.dir}/HeadrApplication.swf" />

                              <arg value="-C" />

                              <arg value="src/" />

                              <arg value="Default.png" />

  <arg value="-C" />

  <arg value="src/" />

  <arg value="Default-568h@2x.png" />

                              <arg value="-C" />

                              <arg value="src/" />

                              <arg value="icons/." />

                              <arg value="data/." />

                    </java>

          </target>

          <target name="package-application-debug-interpreter">

                    <antcall target="pack-application-debug">

                              <param name="debug" value="true" />

                              <param name="flex_config" value="build/app-config-device-debug.xml" />

                              <param name="target" value="ipa-debug-interpreter" />

                              <param name="provisioning-profile" value="ios_profiles/headr_development.mobileprovision" />

                              <param name="keystore" value="ios_profiles/dev_certificate.p12" />

                              <param name="storepass" value="xxxx" />

                    </antcall>

          </target>

          <target name="package-application-debug">

                    <antcall target="pack-application-debug">

                              <param name="debug" value="true" />

                              <param name="flex_config" value="build/app-config-device-debug.xml" />

                              <param name="target" value="ipa-debug" />

                              <param name="provisioning-profile" value="ios_profiles/headr_development.mobileprovision" />

                              <param name="keystore" value="ios_profiles/dev_certificate.p12" />

                              <param name="storepass" value="xxxx" />

                    </antcall>

          </target>

          <target name="package-application-adhoc">

                    <antcall target="pack-application">

                              <param name="debug" value="false" />

                              <param name="flex_config" value="build/app-config-device.xml" />

                              <param name="target" value="ipa-ad-hoc" />

                              <param name="provisioning-profile" value="ios_profiles/headr_development.mobileprovision" />

                              <param name="keystore" value="ios_profiles/dev_certificate.p12" />

                              <param name="storepass" value="xxxxx" />

                    </antcall>

          </target>

          <target name="package-application-appstore">

                    <antcall target="pack-application">

                              <param name="debug" value="false" />

                              <param name="flex_config" value="build/app-config-device.xml" />

                              <param name="target" value="ipa-app-store" />

                              <param name="provisioning-profile" value="ios_profiles/TODO" />

                              <param name="keystore" value="ios_profiles/TODO" />

                              <param name="storepass" value="TODO" />

                    </antcall>

          </target>

          <target name="launch-application">

                    <exec executable="${adl.exe}">

                              <arg value="bin-debug/HeadrApplication-app.xml" />

                              <arg value="-profile mobileDevice" />

                    </exec>

          </target>

</project>

app-config-device.xml

<?xml version="1.0"?>

<flex-config xmlns="http://www.adobe.com/2006/flex-config">

          <compiler>

                    <include-libraries append="true">

                              <library>../libs/swc/robotlegs-framework-v1.5.2.swc</library>

                              <library>../libs/swc/greensock-as3-v11.693.swc</library>

                              <library>../libs/swc/GraphAPI_Mobile_1_8_1.swc</library>

                              <library>../libs/swc/MonsterDebuggerMobile-v3.0.2.swc</library>

            <library>../libs/swc/TheMiner_en_v1_3_10.swc</library>

            <library>../libs/swc/analytics-v1.1.319.swc</library>

            <library>../libs/swc/assets.swc</library>

                    </include-libraries>

                    <source-path append="true">

            <path-element>../../corelib/src/</path-element>

            <path-element>../../corelib/test/</path-element>

            <path-element>../../corelib/libs/src/</path-element>

                              <path-element>../libs/src/</path-element>

                    </source-path>

                    <external-library-path append="true">

            <!-- path-element>../ane/com.headr.HeadrNativeExtensions.ane</path-element -->

            <path-element>../ane/com.milkmangames.extensions.GoViral.ane</path-element>

                    </external-library-path>

                    <debug>false</debug>

                    <define>

    <name>CONFIG::debugging</name>

    <value>false</value>

                    </define>

<define>

    <name>CONFIG::simulator</name>

    <value>false</value>

</define>

          </compiler>

</flex-config>

This topic has been closed for replies.

1 reply

December 21, 2012

You may want to try using the settings used by Flash Builder to package the application, more details of which can be found at:http://helpx.adobe.com/x-productkb/multi/compilation-results-flex-buil der-flex.html

Update your ANT script with these, and try again.