Blackberry 10 Command line development

For BB10 application development, the easy approach is to install the QNX Momentics IDE, to unleash your imagination for developing cool mobile applications. Read a previous article covering the BB10 IDE. There are many situations, however, where a low level control is required, and the command line development tools are indispensable. This guide will show you how to compile and install a Blackberry true native application, using only command line tools.
To get started, we’ll need the command line tools. These are part of the QNX Momentics IDE, so make sure you have it installed.
Step 1: Run a command prompt / shell, go to the location of the QNX Momentics tools, and launch bbndk-env /
Step 2: Using a text editor, write a simple C program, as save it as hello.c:

int main(int argc, char **argv) {
   printf("Hello World!\");
   return 0;

Place it in the same folder with bbndk-env, for convenience.
Step 3: Compile the code with:

qcc -Vgcc_ntoarmv7le hello.c

If you are interested in verbose output, add -v:

qcc -Vgcc_ntoarmv7le hello.c -v

Rename the output to hello (I got a.out as the compiled ELF file)
Step 4: Create the BAR descriptor XML
Every BB10 app must have a BAR descriptor file called bar-descriptor.xml. This is used when installing the app on an actual device. Here is what I’ve used for a minimalistic sample:


Where hello is the ELF file generated by qcc . As you can see, the path indicates we have everything in the current folder.
Step 5: Create the bar file:

blackberry-nativepackager -package bar-descriptor.xml -devMode -debugToken "\"

The debug token must be valid, and match the one installed on your BB10 device. To locate it (or create it) you can use the Momentics IDE.
If everything goes ok, you will get the hello bar package generated, and a warning:
Warning: Using default icon: C:\home\bbndk\host_10_1_0_132\win32\x86\usr\samples\icons\blackberry-tablet-default-icon.png
Info: Package created:

Step 5: Deploy the bar file to a BB10 device

blackberry-deploy -installApp -password 1234

Where 1234 is your BB10 development password. If successful, you would get:

Info: Sending request: Install
Info: Action: Install
Info: File size: 9467
Info: Installing ...
Info: Installing in personal perimeter
Info: Processing 9467 bytes
Info: Progress 100%...
Info: Progress 100%...

And the software can now be seen in the list of programs:

More details
You can specify a custom icon in the bar-descriptor.xml , by adding it to assets and then selecting it with the icon tag:

The native application,


And place the icon.png file in the same folder. After packing, signing and deploying, here is our program amongst others in the list:
Notice the nice, custom icon.

This article has 1 Comment

Leave a Reply