Creating an apk File Using FlashBuilder 4.0



Using FlashBuilder 4.0, you cannot create an apk file through the GUI elements. You need to use AIR SDK commands for accomplishing this. The steps for creating an apk file is provided below:

  (The bin directory refers to the bin directory in your latest AIR SDK. Do the following after you create an SWF file.)

1. In the application descriptor file, edit the supported profiles to <supportedProfiles>mobileDevice</supportedProfiles>.

2. Create a certificate file (.pfx file).

bin\adt -certificate -cn <any-name> 1024-RSA <certificate-file-name>.pfx <password>

3. Assign the certificate to the swf file.

bin\adt -package -storetype pkcs12 -keystore <certificate-file-name>.pfx -storepass <password> <air-application-name>.air <application-descriptor>.xml <swf-file-name>.swf

This command creates a digitally signed air application.

4. Create an apk file.

bin\adt -package -target apk-emulator -storetype pkcs12 –keystore <test_cert.pfx> <name-apk>.apk <application-descriptor>.xml <swf-file-name>.swf

This command creates a valid apk file that you can install in an emulator. You need to provide the password you set in step 3.

5. Install the apk file in the emulator.

<emulator-install-dir>\tools\adb install <apk-name>


7 Responses to Creating an apk File Using FlashBuilder 4.0

  1. André Taron says:

    I’m getting an “Unknown package target -apk-emulator message.

    Must I replace package and target by some actual paths?

  2. Sunil says:

    The command should read as -target apk-emulator. Not -target -apk-emulator. Please check whether you are providing the right command.

    This command creates the apk file in your current directory. You need to provide actual path of pfx, swf, and xml files.

    Thanks.

  3. Kay Siegert says:

    while performing step 4 i´m getting an error message: the key could not be obtained. that happens after i entered the password. Do you know how to solve this?

  4. Sunil says:

    @ Key Siegert
    After the second step, where did you create the pfx file (certification file)? Since you could execute the third step, I assume the pfx file got created.

    In the 4 th step, should be the actual name of the pfx file you created. My instructions would had added a slight confusion. In the 4th step, it would had better if I used .pfx instead of .

    Please try it once again and let me know.

  5. Sunil says:

    Tags in my comment got truncated. Here is my actual comment:

    ==
    After the second step, where did you create the pfx file (certification file)? Since you could execute the third step, I assume the pfx file got created.

    In the 4 th step, test_cert.pfx should be the actual name of the pfx file you created. My instructions would had added a slight confusion. In the 4th step, it would had better if I used certificate-file-name.pfx instead of test_cert.pfx.

    ==

  6. Kay Siegert says:

    Hi Sunil,
    I´m sorry for the delay. I had to put it on hold for a little while.
    Anyway. I played around with it but I still get this error:

    1. added supportedProfile to the xml

    2. created the pfx file (test.pfx) with the password test

    3. assigned the certificate to the swf

    4. executed this command: adt -package -target apk-emulator -storetype pkcs12 –keystore test.pfx pulsr.apk pulsr-app.xml pulsr.swf

    5. password prompt appears, typed in test

    6. packaging failed “The key could not be obtained. You may need to use the -keystore argument with the specified keystore type.”

    Which is weird as it´s all there.

    Any idea? (btw: I´m working on a Mac)

    Cheers,
    Kay

  7. Tami says:

    There must be an easier way.