The Space For App Developers

Beyond Plain Old HTML Objects

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

with 35 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 , , ,

35 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

  27. [...] 有关如何使用 Ant 打包 iOS 应用程序的示例,请参阅 Piotr Walczyszyn:使用 ADT 命令和 ANT 脚本打包 iOS 设备的 AIR 应用程序 [...]

  28. I am trying the same command But i am getting error as application.xml is not valid airi or air file.

    I am using flash builder 4.5.1 adt .
    Please suggest me what is the problem?

    swapnil

    28 Feb 12 at 9:44 am

  29. Hello There. I found your blog using msn. This is a really well written article. I will be sure to bookmark it and come back to read more of your useful info. Thanks for the post. I will definitely comeback.

    Setsuko Forster

    23 Jun 12 at 6:51 pm

  30. Yeah its the old, “Not in my Backyard” attitude. If its really the noise than why do some people have a bluetooth parked in their ear or are constantly on the phone? Have you seen some vehicles with their sound systems that would blow the hair off your arm. Yes, its sounds like drag racing and stock car racing are going away in California. Its sad, but California thinks it forms trends for the rest of the country. Boy are thery wrong. People don’t care. It’s all about me. The hell with everybody else. Get rid of highways or airports ordragstrip as they are too noisy. Very, very sad.

    Rosetta Oktavec

    2 Jul 12 at 2:44 am

  31. You understand therefore significantly in terms of this matter, produced me individually consider it from a lot of various angles. Its like men and women aren’t interested except it’s something to accomplish with Lady gaga! Your own stuffs nice. Always maintain it up!

  32. Such pressure may increase experience other issues, emotional
    or otherwise. The Bluze Capsules and Mast Mood Oil are commonly available in the internet and also in many of the pharmacies that
    are near your home. Some common examples of pills to help with male impotence
    include Viagra and Levitra.

    Penis Dysfunction

    20 Dec 12 at 2:59 am

  33. I use Mac-Mini and have tried building air native extensions on it, got success in that using adt.
    But now i want to compile and create my .ipa on terminal using adt but i get a weird error like following…

    Files “/Users/jaysamapt/Desktop/iPadBuilder/myHelloWorldApp.ipa” and “/Users/jaysamapt/Desktop/iPadBuilder/myHelloWorldApp.ipa” have conflicting package paths: /Users/jaysamapt/Desktop/iPadBuilder/myHelloWorldApp.ipa

    Jay

    28 Dec 12 at 8:15 am

  34. I enjoyed their contribution, and I’m thrilled.
    thanks for the information.

    Jallen K.

    23 Jan 13 at 7:32 pm

  35. I’m not attempting to change the subject, just searchin for a little bit of info because we are wanting to move to another local area and are shopping for an honest moving organization. We were curious about using this company, Move4Less 1015 Shary Cir #7 Concord, CA 94518 – 925-808-3139. Is there some kind of movers fraud or review resource I could possibly use to do a background check?

    Magali Petiet

    26 Jan 13 at 4:21 am

Leave a Reply