BlackBerry Hints n Tips

From Qt Wiki
Jump to navigation Jump to search



Most of the below works only if:

  • the development mode is enabled in the device. If it is not the case, an IP connection to the device cannot be established.
  • You "sourced" the configuration script from the NDK in the current shell. If you have not done so, the tools will not be found.

Use SSH with your device

First, use blackberry-connect to start the SSH demon on the device:

blackberry-connect <device-IP-address> -password <device-password>
-sshPublicKey /path/to/some/public/key.pub

Note. blackberry-connect requires 4096 bit keys. Most probably, your default keys are shorter. Generate an another key pair under a different name, e.g.:

ssh-keygen -b 4096 -f ~/.ssh/id_rsa_4096

As long as the above blackberry-connect command runs in another terminal, you can access the device via SSH with same identity as in /path/to/some/public/key.pub:

ssh -i /path/to/private/key devuser@<device-IP-address>

Be aware, that Qt Creator uses the same procedure to connect to the device, but uses its own keys. If one connection to the device is already open in Qt Creator, you cannot open another one. Disconnect from the device in Qt Creator, first.

Watch the Qt debug outputs

Qt debug outputs, like most other log outputs, are redirected to a special logging framework (called "slog2") instead of STDERR and STDOUT to improve performance. If you use Qt Creator, all Qt debug outputs are copied to the "Application Output" view. Sometimes, it is useful to watch Qt debug outputs in a terminal when the app is started directly from the device shell. First, you log-in via SSH. The slog2info command shows the messages posted into the slog2 framework. If you call it without arguments, it outputs just a current snapshot of messages. You can also start it in a "wait" mode (like tail) and limit its output to the messages from your app only:

slog2info -w -b <app-home-folder-name> | grep 9000

The -b option limits the output to a selected buffer. The name of the buffer of your app is simply the same of the application home folder under /accounts/1000/appdata/. Qt debug outputs are posted under the ID 9000. grep 9000 is used to filter them from others.

Checking other log outputs and getting the core file if an app has crashed

When something happens on start-up (e.g. some dynamic libraries cannot be found) error messages go to the file: /accounts/1000/appdata/<app-home-folder-name>/logs/log.

If your app crashes, its core file is copied into /accounts/1000/appdata/<app-home-folder-name>/logs/

Verify if the BAR application descriptor file and other meta information is correct

  • SSH to the device
  • Go to the home folder of your app
  • Check the app manifest:
> less app/META-INF/MANIFEST.MF

Cases when your app does not start properly

Situation: The app pops-up very briefly on the screen and then closes Possible reason: Your app links to libs which cannot be found or something else is wrong with the app package. You should ssh to the device and check dynamic linker messages in /accounts/1000/appdata/<app-home-folder-name>/logs/log

Situation: The app appears on the screen, but the screen turns dark with a BlackBerry 10 logo in the background Possible reason: One of the Qt plugins failed to load for some reasons. Set QT_DEBUG_PLUGINS=1 in the BAR application descriptor and watch the log in slog2. See Qt docs for more about debugging plugins.

Situation: The app appears on the screen, the screen turns white, but the app UI does not show up Possible reason: One of QML files did not load at start-up. Check the log in slog2.