Pull Android Logs From Your BlackBerry

Editor’s note: below is a blog post from Justin Jasmann, Android Application Development Consultant. Follow him on Twitter at JustinJasmann.


 Imagine this: You’ve got your Android app running well on BlackBerry 10 (that’s awesome by the way), but there’s a small piece that’s not working quite right. How exactly do you go about diagnosing the problem?

As James Dreher pointed out in his post about the 2.0 Command-Line Tools, you can connect your BlackBerry device to whichever IDE you’re most comfortable with. In order to gain access to the LogCat information from there, you can simply debug the Android project, as you would during normal development.

Now I know what you’re thinking: “What if you no longer have the project source?” That’s what I’m here to show you. Today, we’re going to pull the Android logs from your BlackBerry device directly.

There are a few things that you’ll need before we start, so make sure you have these ready:

  1. Android SDK
  2. Command-Line Tools v2.0
  3. An SSH public-key which will represent the host computer that you’re connecting your device to

Note: The easiest way to get a public key created for you is to use Momentics to setup an SSH connection. The rest of the tutorial will use a key that was created for the device via Momentics.

Also note: If you’re having problems creating a public key, you can follow this tutorial.

Let’s get started!

  1. Establish a secure connection to your device using blackberry-connect

establish a secure connection to your device using blackberry connect

  1. With blackberry-connect running, open a new terminal or command-prompt

with blackberry connect running open a new terminal or command prompt

  1. Navigate to the platform-tools directory of your Android SDK. We will be using the adb utility that’s included with the SDK.

navigate to the platform tools directory of your android sdk

  1. Connect to the Android Runtime on BlackBerry 10 using
    1. adb connect

connect to the android runtime on blackberry 10

  1. If you want to output the current contents of the log buffer to a file, use:
    1. adb logcat –d > logfile.log

if you want to output the current contents of the log file

  1. If you’d rather watch the logs live, you can use:
    1. adb logcat

if you'd rather watch the logs live

And that’s it! Simple, right? Let us know if you have any questions in the comments below!

About donnyhalliwell