The Space For App Developers

Beyond Plain Old HTML Objects

Packaging AIR application for iOS devices with ADT command and ANT script

with 26 comments

As you may know AIR 2.6 SDK was released yesterday. It brings a lot of improvements especially for iOS devices (you can find the release information here). Now if you already have a certificate and provisioning profile from Apple and want to try out your existing code to deploy on an iOS device you can use the following ADT command:

[AIR_SDK_HOME]/bin/adt -package -target ipa-test -provisioning-profile [MOBILE_PROVISION_FILE_PATH] -storetype pkcs12 -keystore [CERTIFICATE_FILE_PATH] ./MyApplication.ipa ./bin-debug/MyApplication-app.xml -C ./bin-debug MyApplication.swf -C ./bin-debug assets

Of course, replace the capitalized blocks with your appropriate paths, and then execute it from the root folder of your AIR application project. It will package the app SWF file and any accompanying assets from the bin-debug folder. Bear in mind that this is not a final build ready to be published to the App Store. In order to do that you want to package a release build from the bin-release folder and also use ipa-app-store target parameter instead of ipa-test. UPDATE: Flash Builder may overwrite an application ID in -app.xml with a “.debug” suffix; you should remove it prior to packaging. The ID should match the one registered with your mobile provisioning.

You can achieve the same thing with the following ANT script:

<?xml version="1.0" ?>
<project>
    <!-- SDK properties -->
    <property name="SDK_HOME" value="PATH TO AIR SDK"/>
    <property name="ADT.JAR" value="${SDK_HOME}/lib/adt.jar"/>
 
    <!-- Project properties -->
    <property name="APP_NAME" value="MyApplication"/>
    <property name="APP_ROOT_DIR" value="."/>
    <property name="BUILD_DIR" location="${APP_ROOT_DIR}/bin-debug"/>
    <property name="APP_ROOT_FILE" value="${APP_NAME}.swf"/>
    <property name="APP_DESCRIPTOR" value="${APP_NAME}-app.xml"/>
    <property name="IPA_NAME" value="${APP_NAME}.ipa"/>
    <property name="STORETYPE" value="pkcs12"/>
    <property name="KEYSTORE" value="PATH TO YOUR CERTIFICATE"/>
    <property name="STOREPASS" value="CERTIFICATE PASSWORD"/>
    <property name="PROVISIONING_PROFILE" value="PATH TO PROVISIONING PROFILE FILE"/>
 
    <target name="package">
        <java jar="${ADT.JAR}" fork="true" failonerror="true">
            <arg value="-package"/>
            <arg value="-target"/>
            <arg value="ipa-test"/>
            <arg value="-provisioning-profile"/>
            <arg value="${PROVISIONING_PROFILE}"/>
            <arg value="-storetype"/>
            <arg value="${STORETYPE}"/>
            <arg value="-keystore"/>
            <arg value="${KEYSTORE}"/>
            <arg value="-storepass"/>
            <arg value="${STOREPASS}"/>
            <arg value="${APP_ROOT_DIR}/${IPA_NAME}"/>
            <arg value="${BUILD_DIR}/${APP_DESCRIPTOR}"/>
            <arg value="-C"/>
            <arg value="${BUILD_DIR}"/>
            <arg value="${APP_ROOT_FILE}"/>
            <arg value="-C"/>
            <arg value="${BUILD_DIR}"/>
            <arg value="assets"/>
        </java>
    </target>
 
</project>

Written by Piotr Walczyszyn

March 22nd, 2011 at 2:52 pm

Posted in Examples

Tagged with , , ,

26 Responses to 'Packaging AIR application for iOS devices with ADT command and ANT script'

Subscribe to comments with RSS or TrackBack to 'Packaging AIR application for iOS devices with ADT command and ANT script'.

  1. it possible to package for debug if you don’t have a CERTIFICATE_FILE
    for device that jailbrik?
    and build for cydia ?

    Vasa

    22 Mar 11 at 10:21 pm

  2. @Vasa I have no idea and I don’t have jailbraked device, let me know if you manage to do that ;)

    Piotr Walczyszyn

    23 Mar 11 at 7:36 am

  3. Hi,

    I have an error: Files “F:\Projekty\Arkanoid 360 – Iphone\arkanoid360ip.swf” and “F:\Projekty\Ark
    anoid 360 – Iphone\arkanoid360ip.swf” have conflicting package paths: F:\Projekt
    y\Arkanoid 360 – Iphone\arkanoid360ip.swf

    :(

    MacieK

    24 Mar 11 at 3:11 pm

  4. Try to put your project into a folder without spaces.
    p.

    Piotr Walczyszyn

    24 Mar 11 at 3:14 pm

  5. it works, thanks!

    MacieK

    24 Mar 11 at 3:35 pm

  6. Hi,

    is there an option to specify the ipad as target device? When I deploy a simple test application I don’t get the full screen, although I checked the full screen option in Flash Builder Burrito when I created the mobile project.

    Thanks,
    Tom

    Tom

    11 Apr 11 at 3:27 pm

  7. @Tom

    You can do that like this in the APP_NAME-app.xml file

    <![CDATA[
    UIDeviceFamily

    1
    2

    UIPrerenderedIcon
    YES
    ]]>
    high

    These settings compile with

    small iDevices(iPod, IPhone) – 1
    iPad – 2
    an icon without the ugly gloss
    and retina display – high

    QuintenC

    5 May 11 at 4:42 pm

  8. sorry it stripped some tags but you get the idea

    QuintenC

    5 May 11 at 4:42 pm

  9. I’m trying to create an HTML-based mobile AIR app. I’ve searched all over and found that it may be possible, but it isn’t natively supported by the AIR sdk / Flash builder. Would you happen to have any tips on how to pull that off?

    Mitch Grande

    5 May 11 at 10:56 pm

  10. Hi,
    I got error on entering command. Command is

    Ankur-Agarwals-Mac-mini:hello ankuragarwal$ pfi -package -target ipa-test -provisioning-profile “Macintosh HD/Users/ankuragarwal/Desktop/kamlesh/Developer profile/ 3EEF7335-DE1B-4886-A135-8F9FE46BEEC2.mobileprovision” -storetype pkcs12 -keystore “Macintosh HD/Users/ankuragarwal/Desktop/kamlesh/Developer profile/Certificates.p12″ -storepass Tech8092 “Hello.ipa” “Hello-app.xml” “Hello.swf”

    Error is :

    -bash: pfi: command not found
    What is wrong in my command?

    Sampada

    6 May 11 at 7:47 am

  11. I’ve been a reader of your website for ages. Keep up the excellent writing you are doing.

    Juliann Dematteo

    29 May 11 at 8:22 pm

  12. Testing the ADT with empty file wit one label.

    Takes about 12 min to package it for iOS.

    any help.

    iOSTester

    15 Jul 11 at 4:21 am

  13. @iOSTester if you are doing development you can instead of ipa-test use ipa-test-interpreter mode. This will give you packaging time equal to other platforms although application may run a bit slower as it is interpreted not staticaly compiled.

    Piotr Walczyszyn

    15 Jul 11 at 10:53 am

  14. Thanks, using ipa-test-interpreter made it in few seconds.

    iOSTester

    15 Jul 11 at 12:02 pm

  15. Great writing, Thanks for sharing.

  16. Once the ipa package has been compiled, do you have any tips on how to transfer it to iDevices?

    Matt

    15 Aug 11 at 4:55 pm

  17. @Matt – Create an OTA plist file and put the plist file and ipa on a reachable website. (Search Google for OTA IOS distribution)

    Divya

    15 Aug 11 at 9:19 pm

  18. @Divya – Any tips on doing it through iTunes? I’ve tried a couple of times and it says the entitlements are not valid. Any ideas on how to overcome this?

    Thanks!

    Matt

    16 Aug 11 at 11:35 am

  19. Never mind – I figured out I needed to make the ID in the app descriptor the same as that in the mobile provisioning. Cheers!

    Matt

    16 Aug 11 at 12:36 pm

  20. @Matt just double click it and it should open iTunes then you can sync your iDevice with iTunes and you should have it.

    Piotr Walczyszyn

    18 Aug 11 at 5:52 pm

  21. How do you meant “In order to do that you want to package a release build from the bin-release folder” when there’s no bin-release folder creates and stays with the Flash Builder 4.5.1 – or I’m missing something?

    Santanu Karar

    12 Oct 11 at 4:06 pm

  22. Also, I’m constantly returning an error message “The app ** was not installed on the iPad because the signer is not valid.” while try installing a build with ipa-app-store – I do have proper p12 and provisioning certificates downloaded with Apple Developer Center – does this kind of build requires to be downloaded only from the app store?

    Santanu Karar

    13 Oct 11 at 9:01 am

  23. Hi,
    I am making an app where I have to implement in-app purchase in my project.
    Can anyone tell me how to implement in-app purchase in flex for IOS ?
    Any sample project or good explanation will be helpful to me.

    Thanks in advance,

    jai kishan jaiswal

    30 Nov 11 at 2:32 pm

  24. @jai for in-app purchasing you need to create (or find maybe someone already created one) AIR native extension: http://help.adobe.com/en_US/air/extensions/index.html

    Piotr Walczyszyn

    30 Nov 11 at 3:01 pm

  25. [...] Packaging AIR application for iOS devices with ADT command and ANT script at The Space For App Devel… [...]

  26. Looks like example ant file uses up to 8GB of memory. Is there way to limit it?

    I tried ANT_OPTS and – didn’t help.

    Stan Reshetnyk

    24 Jan 12 at 6:34 pm

Leave a Reply