Using ADB Logcat to debug your Android app installation

A more descriptive title would be, “Using ADB logcat outside of ADT, Eclipse, or Android Studio to debug your Android app installation errors.” Did you try to install the app in your Android device, but got the annoying “Unfortunately, [app name] has stopped”? If so, then you need to run ADB logcat to find out why. Logcat allows us to read the logs that are automatically running in the background when we run the program. So when the app quits suddenly, we can read the messages along the way and pinpoint when it went south. Here are the steps to implement logcat.


ADB (Android Debug Bridge) was stored in my /adt-bundle-mac-x87_64/sdk/platform-tools folder, which I had installed when I first downloaded the Android Development Tools+Eclipse  bundle to my Mac before Android Studio was released.

Also, my .bash_profile hidden file has a line to the above file folder, so when I use the console, it will find the file and start it up. For help with this, see this link and look up “Set up the PATH statements:”

These prerequisites are a must before the following steps can be started.

1. Build your Android app (via cordova build android) and install the app in your device. For instance, I installed Dropbox on computer and device and transferred the files between them with that free service.

2. Plug the device into the computer with your USB plug.

3. Set up the device to enable debugging. In device, Settings:

Allow USB Debugging
Select debug app

4. In console, type to following so we can read all the messages in full:

adb logcat -v long

If you want to output all the messages to a text file on your Mac desktop (it’s different for a PC), type:

adb logcat > ~/Desktop/logcat.txt

Immediately the console should be outputting a lot of lines of text. If it stops at …

- waiting for device -

… and freezes, then check your screen to see if there is a popup to answer. If there is none, then unplug the USB from the device and try again.  In my Settings > Developer Options, I chose “Select debug app,” then chose the app I installed; that might help too.

When the reporting stops, sometimes I hit Return a few times to mark the place with  a large gap of space before doing the next step. This tells me how far to back up.

5. Tap on app icon in device to start it. The dreaded message will appear. Tap OK to quit.

6. Tap Ctrl+C to stop logcat.

7. Review the logcat in the console. Every app is different, so the reasons for breaking will differ. Look for reasons that begin with “Caused by:.” Example:

Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.cordova.splashscreen.SplashScreen" on path: DexPathList[[. . .],nativeLibraryDirectories=[/data/app-lib/. . ., /vendor/lib, /system/lib]]
[ 05-18 20:26:07.190 6365: 6365 I/System.out ]
Error adding plugin org.apache.cordova.splashscreen.SplashScreen.

So it looks like a problem with the splashscreen plugin. What I did is uninstall the plugin (via cordova plugin rm org.apache.cordova.splashscreen.SplashScreen) and add it again (via cordova plugin add org.apache.cordova.splashscreen.SplashScreen). When I did that, I got a clear warning:

WARNING: org.apache.cordova.splashscreen has been renamed to cordova-plugin-splashscreen. You may not be getting the latest version! We suggest you ‘cordova plugin rm org.apache.cordova.splashscreen’ and ‘cordova plugin add cordova-plugin-splashscreen’.

Over the last few weeks, Cordova had earlier renamed its plugins from org.apache.cordova.splashscreen to cordova-plugin-splashscreen. So I removed the first named version again, but added in the second named version. I opened up the /plugins folder and found another org.apache.cordova plugin, removed it, and added it with cordova-plugin-etc. to make sure I got the latest version of that, too.

This resolved the issue, and the app started up normally.

8. If you can’t figure out the reason for the problem on your own, then copy/paste the likely error or fatal line into a search engine and look for answers. If you use or the PhoneGap Google group, include the logcat error lines you found. That’ll help the veterans track it down.

9. To stop debugging, hit Crtl+C. This will return the prompt.

Cool idea to try out: create a screenshot of your device with adb.

1. With your device hooked up, type into console:

adb shell screencap -p /sdcard/screen12345.png

This puts the screenshot into your device. In my case, at the root of Internal Memory in my Nexus 7.

2. Copy it to your computer’s root with:

adb pull /sdcard/screen12345.png

I clicked on my computer’s Home icon and there it was! It was 1200 x 1920 and included the top and bottom screen matter.

3. Remove it from your device with:

adb shell rm /sdcard/screen12345.png

3 thoughts on “Using ADB Logcat to debug your Android app installation

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s