BlackBerry Hints n Tips: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
=BlackBerry Hints and Tips=
__NOTOC__
 
[[Category:BlackBerry]]
 
 


Most of the below works only if:
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.
* 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 <span class="caps">NDK</span> in the current shell. If you have not done so, the tools will not be found.
* 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 <span class="caps">SSH</span> with your device==
== Use SSH with your device ==


First, use <code>blackberry-connect<code> to start the <span class="caps">SSH</span> demon on the device:<br /></code></code>
First, use blackberry-connect to start the SSH demon on the device:
<code>
blackberry-connect <device-IP-address> -password <device-password>
-sshPublicKey /path/to/some/public/key.pub
</code>


'''Note'''. <code>blackberry-connect<code> requires 4096 bit keys. Most probably, your default keys are shorter. Generate an another key pair under a different name, e.g.:</code></code>
'''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.:


As long as the above <code>blackberry-connect<code> command runs in another terminal, you can access the device via <span class="caps">SSH</span> with same identity as in <code>/path/to/some/public/key.pub<code>:<br /></code></code></code></code>
<code>
ssh-keygen -b 4096 -f ~/.ssh/id_rsa_4096
</code>
 
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:
<code>
ssh -i /path/to/private/key devuser@<device-IP-address>
</code>


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.
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==
== Watch the Qt debug outputs ==
 
Qt debug outputs, like most other log outputs, are redirected to a special logging framework (called “slog2”) instead of <span class="caps">STDERR</span> and <span class="caps">STDOUT</span> 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 <span class="caps">SSH</span>. The <code>slog2info<code> 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 <code>tail<code>) and limit its output to the messages from your app only:</code></code></code></code>


The <code>-b<code> 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 <code>/accounts/1000/appdata/<code>. Qt debug outputs are posted under the ID 9000. <code>grep 9000<code> is used to filter them from others.</code></code></code></code></code></code>
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:


==Checking other log outputs and getting the core file if an app has crashed==
<code>
slog2info -w -b <app-home-folder-name> | grep 9000
</code>


When something happens on start-up (e.g. some dynamic libraries cannot be found) error messages go to the file: <code>/accounts/1000/appdata/&lt;app-home-folder-name&gt;/logs/log<code>.</code></code>
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.


If your app crashes, its core file is copied into <code>/accounts/1000/appdata/&lt;app-home-folder-name&gt;/logs/<code></code></code>
== Checking other log outputs and getting the core file if an app has crashed ==


==Verify if the <span class="caps">BAR</span> application descriptor file and other meta information is correct==
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.


* <span class="caps">SSH</span> to the device
If your app crashes, its core file is copied into /accounts/1000/appdata/<app-home-folder-name>/logs/
* Go to the home folder of your app
* Check the app manifest:<br />


==Cases when your app does not start properly==
== Verify if the BAR application descriptor file and other meta information is correct ==


'''Situation''': The app pops-up very briefly on the screen and then closes<br />''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 <code>/accounts/1000/appdata/&lt;app-home-folder-name&gt;/logs/log<code> </code></code>
* SSH to the device
* Go to the home folder of your app  
* Check the app manifest:
<code>
> less app/META-INF/MANIFEST.MF
</code>


'''Situation''': The app appears on the screen, but the screen turns dark with a BlackBerry 10 logo in the background<br />''Possible reason'': One of the Qt plugins failed to load for some reasons. Set QT_DEBUG_PLUGINS=1 in the <span class="caps">BAR</span> application descriptor and watch the log in slog2. See Qt docs for more about debugging plugins.
== Cases when your app does not start properly ==


'''Situation''': The app appears on the screen, the screen turns white, but the app UI does not show up<br />''Possible reason'': One of <span class="caps">QML</span> files did not load at start-up. Check the log in slog2.
'''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


===Categories:===
'''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.


* [[:Category:BlackBerry|BlackBerry]]
'''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.

Latest revision as of 09:31, 25 March 2015



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.