BlackBerry Hints n Tips: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
=BlackBerry Hints and Tips= | [[Category:BlackBerry]] | ||
= BlackBerry Hints and Tips = | |||
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 | * 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 | == Use SSH with your device == | ||
First, use | First, use <code&gt;blackberry-connect&lt;code&gt; to start the SSH demon on the device:<br /><code><br />blackberry-connect <device-IP-address&gt; -password <device-password&gt; -sshPublicKey /path/to/some/public/key.pub<br /></code> | ||
'''Note'''. | '''Note'''. <code&gt;blackberry-connect&lt;code&gt; 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><br />ssh-keygen -b 4096 -f ~/.ssh/id_rsa_4096<br /></code> | ||
As long as the above <code&gt;blackberry-connect&lt;code&gt; command runs in another terminal, you can access the device via SSH with same identity as in <code&gt;/path/to/some/public/key.pub&lt;code&gt;:<br /><code><br />ssh -i /path/to/private/key devuser</code><device-IP-address&gt;<br /><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&quot;) instead of STDERR and STDOUT to improve performance. If you use Qt Creator, all Qt debug outputs are copied to the "Application Output&quot; 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 <code&gt;slog2info&lt;code&gt; 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&quot; mode (like <code&gt;tail&lt;code&gt;) and limit its output to the messages from your app only: | |||
</code><br />slog2info -w -b <app-home-folder-name&gt; | grep 9000<br /><code> | |||
The <code&gt;-b&lt;code&gt; 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&gt;/accounts/1000/appdata/&lt;code&gt;. Qt debug outputs are posted under the ID 9000. <code&gt;grep 9000&lt;code&gt; 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: <code&gt;/accounts/1000/appdata/&lt;app-home-folder-name&gt;/logs/log&lt;code&gt;. | |||
If your app crashes, its core file is copied into <code&gt;/accounts/1000/appdata/&lt;app-home-folder-name&gt;/logs/&lt;code&gt; | |||
== | == 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:<br /></code><br />> less app/META-INF/MANIFEST.MF<br /><code> | |||
== Cases when your app does not start properly == | |||
'''Situation''': The app | '''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&gt;/accounts/1000/appdata/&lt;app-home-folder-name&gt;/logs/log&lt;code&gt; | ||
'''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 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<br />''Possible reason'': One of QML files did not load at start-up. Check the log in slog2. |
Revision as of 10:35, 24 February 2015
BlackBerry Hints and Tips
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 <code>blackberry-connect<code> to start the SSH demon on the device:
<br />blackberry-connect <device-IP-address&gt; -password <device-password&gt; -sshPublicKey /path/to/some/public/key.pub<br />
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.:
<br />ssh-keygen -b 4096 -f ~/.ssh/id_rsa_4096<br />
As long as the above <code>blackberry-connect<code> command runs in another terminal, you can access the device via SSH with same identity as in <code>/path/to/some/public/key.pub<code>:
<br />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&quot;) instead of STDERR and STDOUT to improve performance. If you use Qt Creator, all Qt debug outputs are copied to the "Application Output&quot; 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 <code&gt;slog2info&lt;code&gt; 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&quot; mode (like <code&gt;tail&lt;code&gt;) and limit its output to the messages from your app only:
slog2info -w -b <app-home-folder-name> | grep 9000
The <code&gt;-b&lt;code&gt; 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&gt;/accounts/1000/appdata/&lt;code&gt;. Qt debug outputs are posted under the ID 9000. <code&gt;grep 9000&lt;code&gt; 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: <code&gt;/accounts/1000/appdata/&lt;app-home-folder-name&gt;/logs/log&lt;code&gt;.
If your app crashes, its core file is copied into <code&gt;/accounts/1000/appdata/&lt;app-home-folder-name&gt;/logs/&lt;code&gt;
== 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:<br />
> 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 <code>/accounts/1000/appdata/<app-home-folder-name>/logs/log<code>
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.