Hello NDK beta 2 – Step by Step

The second beta of the Native SDK is now available at native/beta microsite – the corresponding runtime is – and this post shows how to compile, package, and install the first Hello Graphics Sample using just the command-line.

Download NDK and Prep Your PlayBook

Point your browser to the download page, and download the SDK.  The bundle includes the full, Eclipse-based, Momentics IDE and is 400MB; in this post I will only use a few command-line commands, but there is no smaller bundle.  Yesterday I encountered some download failures when using Chrome (on MacOS), but Safari worked fine.

The post assumes you have a PlayBook (you can buy one here) so you will not need to download the simulator.

You will need to install the latest 2.0 OS beta on your device as described in Unbox your PlayBook with a 2.0 Twist.  You will also need a debug token an you can follow the instructions in Installing a Debug Token on your PlayBook; the NDK has its own copy of the commands used there: blackberry-debugtokenrequest and blackberry-deploy.

bash-3.2$ blackberry-debugtokenrequest -storepass MYSTOREPASS \

bash-3.2$ blackberry-deploy -installDebugToken MYDEBUGTOKEN.bar \

Note to create a Debug Token you will need RIM to mail you Signed Keys and that currently can take a couple of hours.

Install the NDK

Install the NDK as usual.  I used the default location; in my Mac this was /Developer/SDKs/bbndk-2.0.0-beta2. The NDK includes a bbndk-env.sh file that defines needed shell variables including Makefile flags, PATH, targets, etc. You need to source this file so makes and commands work as desired

source /Developer/SDKs/bbndk-2.0.0-beta2/bbndk-env.sh

Download and Compile the Sample

Next, download the sample you want to use from the NDK Sample Apps.  In this case we will use the first Graphics samples.

Expand the ZIP file into some new directory, navigate to the subdirectory that is pre-arranged to be compiled via a Makefile, and compile the sources via a single make command.

bash-3.2$ unzip HelloNativeSDK.zip
bash-3.2$ cd HelloNativeSDKMakefile
bash-3.2$ make

I’ll skip the verbose output but the result is to compile and load the program. The result is in the x86/ and the arm/ directories.


Next we will take the arm/o.le-v7 objects and we will package that into a bar (the format used for PlayBook applications) using the bar-descriptor.xml. We will also request the bar to be packaged in devMode, and we will sign it using the debugToken we have created previously. The sample also includes an icon for the application that will be used in the home screen.

The complete command is as follows:

blackberry-nativepackager -package out.bar -devMode \
-debugToken MYDEBUGTOKEN.bar \
bar-descriptor.xml -list -listManifest \
-e arm/o.le-v7/HelloNativeSDKMakefile HelloNativeSDKMakefile \

I added a -list and a -listManifest flags to the command so you can see what’s created, but that is not necessary. The resulting bar is out.bar.

Added – Elena pointed out than rather than indicate any of the assets to include in the bar, use the BAR descriptor using the -D flag:

blackberry-nativepackager -package out.bar -devMode \
-debugToken MYDEBUGTOKEN.bar \
bar-descriptor.xml -list -listManifest \

Note that if you list any assets in the command line that has precedence over the information in the descriptor, so don’t list any.


Before installing into the PlayBook, remember to put it in Developer Mode, to note its device address, to assign – and remember – a device password, and to upload the same debugToken we used above onto it. All this is described in  Installing a Debug Token on your PlayBook.

And now you are ready, just need to:

blackberry-nativepackager -installApp \

Note that you do not need to connect the device via a USB cable; plain WiFi will work.

And that’s it. You should see something like:

Info: Sending request: Install
Info: Action: Install
Info: File size: 21620
Info: Installing ...
Info: Processing 21620 bytes


After this your PlayBook should have the application. Launch it and you will see…


About pelegri

VP, Technology at Progress Software
This entry was posted in Native and tagged , . Bookmark the permalink.

11 Responses to Hello NDK beta 2 – Step by Step

  1. pelegri says:

    It looks like that particular sample (the Graphics hello) is temporarily not available from the beta micro-site. The instructions will apply equally well to any of the other samples. And, if you want to use that specific sample app, it is equally available from NDK micro-site

  2. pelegri says:

    Adjustment to the comment about using “-D”; that works very well with NDK 1, but will not work for NDK 2 as-is. Need to modify the bar-descriptor.xml so libbps is found at ../qnx6/… instead of ../target-override. It makes sense, but… 😦
    Completing a pass through all the samples I can find, then will file bugs tomorrow.

  3. Pingback: Where is that Log? DevUser and Account 1000 on PlayBook | Open BB News

  4. Arch says:

    Doesnt look like MAC installer is working ?

    • pelegri says:

      I think it is an interaction between the Akamai NetSession client and the replication. Work-around is to do a “save-as” instead of using the button (which activates the akamain netsession client). Let me know if that workaround does not work.

      Can you post your configuration? Which browser and what version of it, geographic location (rough is enough), and version of MacOS? I’ve been waiting for the end of the Holidays to bring this up with the responsible folks and the more data points we have the easier it will be to locate the problem and fix it.

  5. pelegri says:

    Arch – I re-read your comment and I see it says “installer”. Did you successfully download the bundle and then the installer failed? If that was the case, can you provide more details?

  6. Pingback: DosBox – From GitHub to Your PlayBook | Open BB News

  7. Qi Chao Zhu says:

    Hi Pelegri,
    I am trying to build a hello world C program in Native SDK for tablet OS. It succeeds to compile but fail to launch it on device. Everytime it copies the program to the device and then open it with a blank window. Then the window immediately close with an error on QNX Momentics IDE: “ldd:FATAL: Could not load library libbps.so.3”. I have found libbps.so.3 on my PC folder which means the corresponding library missing on the device. How should I do to solve it? Google for nothing similiar issue.


    PS, I installed Native SDK 2.0 on Windows XP and the OS version on playbook is



    • pelegri says:

      Are you using the NDK1 or the NDK2 samples?
      Ah! you wrote your own?
      I’d suggest you go check how the NDK2 sample descriptors are organized.

      Sorry for not looking more carefully, rushing to catch planes that eventually will get me to DevCon

  8. Peter Hansen says:

    Nice write-up, Eduardo. Other than having to sort out an issue running the installer on 64-bit Linux (for Ubuntu, needed “sudo apt-get install ia32-libs” first), it works flawlessly. I actually installed on a bottom-end Rackspace VPS and so far no problems running it all, and that saved me setting up another box here at home. Thanks!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s