Home / Tutorials /

10 Easy Steps to Package and Sign AIR Apps for PlayBook

Packaging for BlackBerry PlayBookIt has become a little obvious that the packaging, signing and publishing to BlackBerry PlayBook is a little difficult process. Yes, it took me a while to figure out how to do it. Had to browse through a lot of documentation to understand the process.

Thought of writing a simpler, straight forward post that will explain and show how to do the same in easy steps (for those who don’t want to spend more time understanding every aspect of it).

Assuming the AIR app is built using Flash Professional CS5 (that’s what I did), I am using command-line tools to get through this process. So, it is also obvious that this process is for pure ActionScript projects.

The screenshots of the Terminal window that you see in this tutorial are the actual screenshots I took. I wrote this tutorial first and then followed the commands I have mentioned myself and took the screenshots. I also didn’t get any errors following this. So, I am pretty sure this process works. :)

Publish the SWF file

First, have the .SWF file published.


Have the resources ready

Now, you will need 4 files to create a nice package: -

  1. Application Descriptor XML (game-app.xml)
  2. Icon file that goes on the tablet’s applications screen (icon.png)
  3. A splash screen PNG file that appears before the actual swf is executed in the tablet (splash.png)
  4. Icon and Splash screen mentioned in an XML (blackberry-tablet.xml)

Step 1: Download and install the SDK

Download and install the BlackBerry Tablet OS SDK for Adobe AIR from – http://us.blackberry.com/developers/tablet/adobe.jsp

I have not covered the installation, setup and execution of the simulator in this post. Therefore, I will just mention the steps required to install the SDK, create package and sign the package. The link to download the SDK should be similar to the image below for your respective platforms: -

Download BlackBerry Tablet OS SDK

Installing the SDK should dump the SDK into a folder name similar to – “blackberry-tablet-sdk-0.9.3″. These are the folder contents: -

SDK Installed Folder


Step 2: Just before packaging

This is how my directory looks before I start packaging. It contains the resources mentioned in Step 1 and the downloaded SDK.

Folder before packaging


Step 3: Create the blackberry-tablet.xml

This XML file contains the icon and splash screen that need to appear on your tablet’s applications screen and just before opening the application respectively. Below is the screenshot that shows the appeared icon_86.png and crazygems-splash.jpg used in blackberry-tablet.xml: -

Icon and Splash

<qnx>
  <initialWindow>
    <systemChrome>none</systemChrome>
    <transparent>false</transparent>
  </initialWindow>
  <publisher>hsharma.com</publisher>
  <category>core.games</category>
  <icon>
    <image>Icon_86.png</image>
  </icon>
  <splashscreen>crazygems-splash.jpg</splashscreen>
</qnx>

Step 4: Create the Application Descriptor XML (CrazyGems-app.xml)

This is by default generated by Flash Pro when your publish settings is set to AIR 2.5. I have made minor changes that restrict the orientation to landscape only.

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<application xmlns="http://ns.adobe.com/air/application/2.5">
    <id>com.hsharma.crazygems2</id>
    <versionNumber>2.1.0</versionNumber>
    <filename>Crazy Gems 2</filename>
    <description>Crazy Gems 2.1</description>
    <name>Crazy Gems 2</name>
    <copyright>http://www.hsharma.com/projects/crazygems2</copyright>
    <initialWindow>
        <content>CrazyGems.swf</content>
        <systemChrome>standard</systemChrome>
        <transparent>false</transparent>
        <visible>true</visible>
        <fullScreen>false</fullScreen>
        <autoOrients>false</autoOrients>
        <aspectRatio>landscape</aspectRatio>
        <renderMode>auto</renderMode>
        <maximizable>false</maximizable>
        <minimizable>true</minimizable>
        <resizable>false</resizable>
    </initialWindow>
    <customUpdateUI>false</customUpdateUI>
    <allowBrowserInvocation>false</allowBrowserInvocation>
</application>

Step 5: Create the .bar package

This is the simple command that is used to package the .swf and other resources into .bar. Note: The packaging and signing tools are in the subfolder “bin” under the SDK folder.

blackberry-airpackager -package DesiredPackageName.bar game-app.xml blackberry-tablet.xml GameOrApp.swf IconFile86x86.png AllOtherFilesRequiredByYourSwf SplashScreen.png

Note that all the text in red needs to be replaced with the files that you prepared in Step 1. SplashScreen.png and IconFile86x86.png refers to the files included in the blackberry-tablet.xml file in Step 3.

AllOtherFilesRequiredByYourSwf parameter in the above command is where we need to specify all files that are required by the app .swf in runtime. These filenames should be separated by spaces. Also, don’t forget to copy the files in the same folder as .swf.

Now, using this command to actually package my game, looks like this: -

blackberry-airpackager -package CrazyGems2.bar CrazyGems-app.xml blackberry-tablet.xml CrazyGems.swf Icon_86.png crazygems-splash.jpg

Command: Create .bar package

This generates the desired CrazyGems2.bar file.

I have ignored -launchApp, -installApp and -device and -password parameters of command-line as they are for running and testing the app on the PlayBook or simulator.


Step 6: Preparing for signing

To sign your package, you will need a signing key from BlackBerry. You can request for the same from https://www.blackberry.com/SignedKeys/.

In this process, please keep in mind that the PIN you enter in the field shown below is extremely important. Do not forget this. Also, note that this PIN allows alpha-numeric characters. The catch is, the alphabets used will be forced to small-case.

PIN

You will receive a .CSJ file in a couple of days from BlackBerry.


Step 7: Creating the CSK file

Once you receive the .CSJ file and you are ready to sign, you will need to open Command Prompt (Windows) or Terminal (Mac).

Make sure you change directory to the one where your SDK is copied. Enter the following command to create a .csk file: -

blackberry-signer -csksetup -cskpass DesiredCSKPassword

Command: Create .csk file

Again, text in red is what you need to fill in with your information. Enter the desired password for csk file. This password will be used in just a bit. Also, the file created won’t be in the same folder. This is created in -

Mac:

~/user/Library/Research In Motion/barsigner.csk

Win:

\Document and Settings\<name>\Local Settings\Application Data\Research In Motion\barsigner.csk

or

\Users\Youraccount\AppData\Local\Research In Motion\barsigner.csk

Deleting the CSK (just in case)

If you have already created a .csk and want to delete it, use the command below: -

blackberry-signer -cskdelete

Command: Delete .csk file


Step 8: Register with RIM Server

Now, you need to register with RIM Server using the .csj file. Run the following command: -

blackberry-signer -register -csjpin PinYouEnteredWhileRequestingCSJ -cskpass PasswordYouEnteredWhileGeneratingCSK client-RDK-XXXXXXXXXX.csj

PinYouEnteredWhileRegisteringCSJ – is the one you entered by choice in Step 6.

PasswordYouEnteredWhileGeneratingCSK – is the one you entered by choice in Step 7.

Once you submit, you should see the response – “Successfully registered with server.”

Command: Register with RIM

Once you get this message, you should also have received a confirmation email from “websigner@ws-smtp.rim.net” with the subject “Successful Registration Request for Client ’1279793156′”.


Step 9: Create the .p12 Certificate

Once you have registered with RIM server, you can generate the .p12 certificate required to sign your .bar file package. :) Finally… eh? Not yet actually… Signing in next step. ;)

blackberry-keytool -genkeypair -keystore DesiredCertificateName.p12 -storepass NewPassword -dname "cn=YourCompanyName" -alias author

Make sure you modify only the red text in the above command.

YourCompanyName can contain spaces and full-stop. But not comma.

Command: Create p12 Certificate


Step 10: Sign the package with the .p12 Certificate

Finally, we are now ready to sign the package we created in Step 7. Note that you will need to sign the .bar file twice. Once from RIM and once from you as an author.

Use the below command to sign the .bar file first time: -

blackberry-signer -verbose -cskpass CSKPassword -keystore CertificateName.p12 -storepass StorePassword BarFileNameForRIMToSign.bar RDK

CSKPassword – from Step 7.

CertificateName – from Step 9.

StorePassword – This is the NewPassword from Step 9.

BarFileNameForRIMToSign.bar – The .bar file created in Step 5.

Command: Sign .bar file by RIM

Now, sign the already signed file. The first time you signed, was from RIM. Now you sign from the author’s (your) side.

blackberry-signer -keystore CertificateName.p12 -storepass StorePassword RimSignedBarFile.bar author

CertificateName – from Step 9.

StorePassword – This is the NewPassword from Step 9.

RimSignedBarFile.bar – The .bar file created in Step 5 and signed in Step 10 in previous command.

Command: Sign .bar file by author

This signs the .bar file again.


Conclusion

So, here you go. You should have a final .bar file that is ready to be published on the BlackBerry App World. Please do write back if you find issues. I will try my best to point you to a possible solution or place where you can find one… :)

Happy packaging!


UPDATE:

If you get an error “Code signing request failed because this file has been previously signed.” when you try to sign a new package (probably not a major change) with same name and version for your app, change the <versionNumber>x.y.z</versionNumber> tag (line 4) in Step 4. Good idea to increment “z” in the version (revision version). Then try to repackage and it should work.


  • http://www.mellisdesigns.com Mitch Ellis

    Hey Hemanth

    I think I worked it out, If you want to keep using your certificate to sign your applications, do NOT use the blackberry-signer -cskdelete
    command. It will break the link between your CSK and CSJ and stop you from signing your certificate and application with the rim servers.
    You are also unable to go through the process of re registering because each CSJ file can only be registered once.

    Waiting for a new key to start it again.

    Mitch

  • James

    @Mitch

    I’m having the same issue… I tried to register my application with Flash Builder Burrito first, and I think it messed up everything… the signing process in the Burrito is not fully functional and I wasn’t aware of that, then I follow these steps by Hemant, but as we can’t register our CSJ file again…

    so, what should I do now? I have sent an email to RIM support about 10 days ago but it seems like they are too busy to reply and support the developers…. Added app for approval 14 days ago, which is stuck in the TEST HOUSE from 4th April… The signing process is one of the worst authentication processes I have ever seen or been through… Lots of confusing steps to follow initially… can’t they make a one click tool to sign apps and make our lives easier so we can concentrate on apps rather than these post painful processes…
    Great experience so far and Great work RIM…

    Now, I want to give it a last try… somebody tell me what to do now? Do I need to get a new CSJ file? and what if I use different systems at my home for my development… and I guess this CSJ file will be registered with one system only… so I won’t be able to use with my other systems? Right? AMAZING…

  • http://www.mellisdesigns.com Mitch Ellis

    Hey James

    Hemanth might want to pick something up from what his experience is, but I will let you know based on the hours of research I have done to fix the problem I had.

    Don’t bother about support, they wont get back to you for a while, your best option is to apply for another CSJ file again. The CSJ file you have will already be authenticated on the RIM servers, thus not matter what computer you try to authenticate on, it will always say that the file has already been authenticated once.

    Once you apply for that new file, and remember or write down your pin somewhere, go to your SDK directory, open up terminal or cmd and delete your existing CSJ and CSK files by using the command:
    blackberry-signer -cskdelete
    Delete any former *.p12 files you have in the directory.

    You are now in a state to start from scratch using Hemanth guide, which I once again say, is the best on the net.

    Remember when you create your bar file, open it up with 7zip or any other zip programs and check the contents. Check the MANIFEST.MF file using notepad and make sure that all your links, icons, splash screens and anything else inside the bar file has all the proper links and are linked to the right files.
    *My app go denied because my link to the default ICON file was pointing to my 128 pixel version instead of my 86 pixel version.
    Go through all of the steps in Hemanths guide for signing and you all should be good. If you need to resign the file again you only need to go from step 10 and all should be good.

    Best of luck!

    Mitch

  • http://www.zgflex.org Ivan Ilijasic

    Mitch, you mentioned MANIFEST.MF

    Few days ago I received an email that my signing process was denied because in my BAR file I need some other files. Here is C/P from this email:

    You should also have the following files as a general rule as an end result when signing your application:
    - RDK.SF
    - RDK.EC
    - MANIFEST.MF
    - AURTHOR.SF
    - AUTHOR.EC
    These should all be contained within your .BAR file

    Do you have these files in your BAR archive?

    P.S. Best thing is – first I received an email that my signed application is approved and then one month later I received this new email :)

  • James

    Thanks Mitch, really appreciate your help… Just applied for new CSJ file…

    What about signing from multiple systems, if I register this CSJ file with my desktop then for my laptop I have to get a new one?

    Also, is there any way to make backup of these CSK and other files after registration, in case I need to re-install my operating system in future?

    Thanks in anticipation…

    James

  • http://www.mellisdesigns.com Mitch Ellis

    @James there is some info about registering multiple users from the one CSJ file, but you might have to scoop around to find out about it and find out how to do it. I think this whole process is fairly new to RIM so after they have released the Playbook, they might simplify the process.

    @Ivan so basically if you open up your *.bar file with winzip, winrar or 7zip you will see the following folder structures:
    air and META-INF
    air -> contains all of your assets and files for your application
    META-INF -> contains all of signing and descriptor files.

    When you first create the bar file using blackberry-airpackager your META-INF folder, when you open your bar file with a zip program, will have the following file:
    MANIFEST.MF

    When you go through the first Signing process, the one with RIM, in Step 10, you will get the following files added to the bar file, inside META-INF
    MANIFEST.MF
    RDK.SF
    RDK.EC

    and when you finally sign again for yourself you will get the following files added to the bar file inside META-INF directory:
    MANIFEST.MF
    RDK.SF
    RDK.EC
    AUTHOR.SF
    AUTHOR.EC

    When you have these five files inside your META-INF folder you are signed and ready to upload.

    Mitch

  • http://www.zgflex.org Ivan Ilijasic

    Thank you Mitch. My new CSJ file has just arrived. I’m looking forward to finish this process this evening :)

  • William R. J. Ribeiro

    Hi guys,

    if you are getting the error message:
    barsigner error: Certificate chain not found for: RDK RDK must reference a valid Keystore key entry containing a private key and a corresponding public key certificate chain.

    The ‘RDK’ parameter means that you are requesting RIM to verify your signature.
    When you provide ‘author’ it means that you are verifying yourself which is not the safest mechanism (because we need a trusted entity to confirm that you are _really_ you).

    If you have problems with the RDK, use author but I’m not really sure if this will be approved by RIM since they are not verifying you.

    I hope it helps.

    Cheers.

  • http://www.flexdomino.net Matthias Wille

    Very useful instructions indeed. I had a few problems not discussed in here regarding signing my Flash Builder 4 Burrito application. I documented it here…

    http://flexdomino.blogspot.com/2011/04/signing-your-playbook-apps-for.html

  • Pingback: Blackberry app signing trouble

  • http://www.blog.mpcreation.pl/ mpc

    Hi, I have a problem in step 8 I get this error ‘barsigner error: illegal option: -csjpass’ I am 99,9% sure I am using the correct pin….

  • Pingback: [Speaking]: 5 สิ่งที่คุณควรรู้ก่อนเริ่มพัฒนา mobile application | Teerasej's Adobe Flash P

  • Pigi

    Before publishing the file on appworld how I can upload it to my playbook in order to try it?

    Many thanks

  • Satish

    i have occurred bellow error when i am executing this command
    blackberry-signer -keystore CertificateName.p12 -storepass StorePassword RimSignedBarFile.bar author

    “barsigner error: Certificate chain not found for: author_name. author_name must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain.”

  • http://www.smartlittlekid.com LVMobile

    Fixed – “barsigner error: Certificate chain not found for: author_name. author_name must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain.”

    Instead of using “-alias author”, used
    blackberry-keytool -genkeypair -keystore xxxx.p12 -storepass zzzzzz -dname “cn=Smart Little Kid” -alias

    Then, replace the RDK with the alias used above
    blackberry-signer -verbose -cskpass yyyyyy -keystore xxxx.p12 -storepass zzzz VegasCasinoMaps.bar

  • Pingback: @renaun posts: PlayBook (.bar) Application Signing Roundup

  • Pingback: About Blackberry PlayBook and Adobe AIR 2.5 setup « priyeshsheth

  • http://designaid.wordpress.com Luis Suarez

    wow thank you very much for sharing. it helped me quite a lot.

    cheers.

    Luis S.

  • Pingback: PlayBook (.bar) Application Signing Roundup | FlexHero

  • http://www.brunoimbrizi.com bruno imbrizi

    If you go to the BlackBerry developers site and click on “Learn about signing your application”, all you get is a rough list of steps to follow. Specially steps 3 and 4:

    3. Configure your computer to communicate with the RIM® Signing Authority
    4. Register with the RIM Signing Authority using your CSJ registration file for application signing.

    How to configure your computer? How to register with RIM Signing Authority?
    I couldn’t find any details about it in the BlackBerry site.

    Thanks a lot for your post. I wouldn’t have managed to sign my app without it.

  • Pingback: All 06/26/2011 | Just Nenad

  • Maged Zakhary

    Hi Hemanth,

    I am a Windows 7 user. I have a problem with step no.7 while creating the CSK file. I opened the cmd and wrote the command, then the cmd prompt that CSK file created. But, when I navigate to the folder (…..\Research In Motion) I don’t find the file.

    Thanks in advance for your support.

  • Aarón

    You are the king!!!
    100% works :D

  • Jagadesh

    Hi Damian,

    Many thanks for this. Much clearer than the official RIM instructions!
    I get to Step 9 OK then get an error message.

    The command I type at this step is:
    blackberry-keytool -genkeypair -keystore damiansHockeyCert.p12 -storepass itmasppal -dname “cn=NA” -alias author

    The error message I get back is:
    keytool error: java.io.FileNotFoundException: damiansHockeyCert.p12 (access is denied)

    Do you know why I might be getting this and can i know what all r the permissions i need to give?

    Thanks in advance.

  • Pingback: Genes to Cognition (3D Brain) - BlackBerry Forums at CrackBerry.com

  • Pingback: Android App Working On os2 - Page 44 - BlackBerry Forums at CrackBerry.com

  • Pingback: Tools to help make the APK -> BAR process easier - Page 9 - BlackBerry Forums at CrackBerry.com

  • Pingback: Tools to help make the APK -> BAR process easier - Page 11 - BlackBerry Forums at CrackBerry.com

  • Pingback: Request: Tutorial APK to BAR - BlackBerry Forums at CrackBerry.com

  • Leo

    When I execute the step 10.

    Step 10: Sign the package with the .p12 Certificate

    After cmd window update to connecting to Waterloo and then close forever. No more executive lines.

    No RDK.EC and RDK.SF in the .bar file. ???

    I tried to register csj file again. Still fail.

    Does anyone have any suggestion?

    Thank your help.

  • Sanjeeb Sahu

    Thanks a lot for giving the knowledge of packaging system….

  • Pingback: Super Ninja Skydiving Plus Zombies - Page 3 - BlackBerry Forums at CrackBerry.com

  • Pingback: very good tutorial for deploy blackberry playbook app | code@butterflybone

  • Pingback: Tools to help make the APK -> BAR process easier - Page 27 - BlackBerry Forums at CrackBerry.com

  • Pingback: NORTHWAY Games » Blog Archive » Rebuild: Porting to the PlayBook via Adobe AIR and FlashDevelop