Deployment on BlackBerry 10
This article explains various details about deployment on BlackBerry 10 for Qt developers. Generally, this topic is well explained in the BlackBerry 10 documentation for native application development. In this article, you will find some additional details and tips specific for Qt development.
Start with BlackBerry 10 docs
It is good to get an overview first if you are new to a platform. Please read the following overview articles in the BlackBerry 10 documentation:
- Developing apps [developer.blackberry.com] and all articles in that section.
- The BAR application descriptor file [developer.blackberry.com] and App permissions [developer.blackberry.com]
- App Life Cycle [developer.blackberry.com]
- Working with the file system [developer.blackberry.com]. This article also explains how standard Qt paths, e.g.
are mapped to the file system.
- Using low-level functionality [developer.blackberry.com]
The page Packaging, deployment and distribution [developer.blackberry.com] is a good introduction to the tools and how to use them.
In short, applications are packaged in so called BAR files which are zip archives with additional meta information.
Blackberry Application aRchive (BAR) descriptor fileA part of this meta information is the content of the BAR application descriptor file [developer.blackberry.com] which is an XML file. It describes the content of the package and where this content can be found. There is other important meta information which is less relevant to this article. Qt Creator has an editor for the BAR application descriptor files which simplifies quite some manual editing. The content of the package may also include images, sounds and any other data files used by the application in addition the the binary.
See full list of all elements in a BAR application descriptor file [developer.blackberry.com]
Application packages are created by the command line tool
This tool reads a BAR application descriptor file passed as an argument and builds the application package accordingly.
Application packages can be built in a development mode or can be signed.
Development mode applications require a debug token and can be installed and run on any device with the same debug token as they were build with.
Signed packaged are usually used for publishing in BlackBerry World. They can also be installed from the command line on any device in development mode.
See full article [developer.blackberry.com]
Where do the app resources land on the device
Each application is installed in its own home folder on a dedicated partition. Shared folders are mapped according to permissions requested so that the app can access them under the standard paths. An important thing to keep in mind is that all applications can access files only within the boundaries of their “sand boxes”.
As mentioned in Working with the file system [developer.blackberry.com] each application has a set of sub-folders for different purposes in its home folder.
Applications cannot directly access any files outside the sandbox. Even though it is possible to package and deploy libraries with the application, it is not possible to deploy any libraries into system folders. Applications cannot share their libraries with other applications either.
In some cases, it might be needed to inspect the actual content of the folders directly on the device. You can do this in an ssh shell. The article BlackBerry Hints and Tips shows how to do this along with a few other hints and tips.
Deploying Qt5 applications using the binary Qt5 overlay
The easiest way to deploy Qt5 applications for testing and distribution in Blackberry World is to use the binary overlay explained in Qt5 on BlackBerry10
Deploying a Qt runtime for a shared use by multiple apps in development
If your application has been packaged in the development mode (the
), it gets slightly more permissions than if it was in the release mode (see this article [developer.blackberry.com] in the BlackBerry 10 documentation for mode details). One of those permissions is a read/write permission for the
is a user account on the device linked to your debug token.
This folder can be used to deploy a Qt runtime in such a way that it can be accessed by multiple applications in the course of development. Therefore, you can save a lot of time with very short deployment cycles, even if you would like to use a version of Qt which is not available in the device firmware, since you do not need to add the Qt runtime to each application package you deploy.
If you are working on Qt, you can also use this method to deploy a experimental version of Qt for testing.
The following section explains how this can be done.
Note: this method does not apply to signed application packages. Applications in the signed mode cannot access the
The basic idea is to copy the Qt runtime binary artifacts into a subfolder in
on the device, and set relevant environment variables, e.g.
, to point to that Qt installation.
Note: a build of Qt 4.8 is pre-integrated in each BlackBerry 10 firmware and NDK release. You should not waste your time for adding another Qt 4.8 build unless you have a good reasons for this.
Copying the Qt libraries onto the device
First you need to establish an SSH connection to the device. See BlackBerry Hints and Tips to learn how to do this.
Lets assume that
points to the root folder of a cross-compiled Qt5 build for BlackBerry 10. First, we copy its runtime:
- > ssh -i /path/to/private/key devuser@<device-IP-address> "mkdir -p /accounts/devuser/qt"
- > cd $QTDIR
- > tar cpf - lib plugins qml | ssh -i /path/to/private/key devuser@<device-IP-address> tar xp -C /accounts/devuser/qt/
If you have a Qt4 build you need to copy the
folder instead of the
Make sure that
/path/to/private/key> is the private key part from the public key you used to initiate the SSH daemon on the device with
as outlined in BlackBerry Hints and Tips .
Deploying will be even faster if you strip the libraries before copying them. Note that this removes debug symbols from the Qt libraries as well. On a BlackBerry 10 device this can be done with:
- > cd $QTDIR
- > find -L . -name "*.so*" | xargs ntoarm-strip
for the simulator target. On PlayBook, you can do:
- > cd $QTDIR
- > find -L . -name "*.so*" | xargs arm-unknown-nto-qnx6.5.0-strip
Setting up the environment variables
After Qt is deployed, you need to change your BAR applications descriptor file so that the relevant environment variables point to the new Qt installation, instead of or in addition to the the default ones. Add the following lines to your
file for a Qt5 build:
Note that this method also allows to have additional libraries and plugins inside the BAR package, which would override the installed versions.