Get Android stack trace from device using Debug Bridge

Instead of crashing, sometimes your Android application will stop responding and dump a stack trace to the device. You probably will not be able to access this using Android File Transfer, and if you view it using the Dalvik Debug Monitor Server (DDMS) the data directory will probably appear empty.

You can get the file using the Android Debug Bridge (ADB) however. The easiest way to set this up is to create a symlink (on a Mac, easier to add the path in Windows I imagine) to adb from /usr/sbin/. The command will depend on where you installed the Android SDK…

sudo ln -s /usr/local/android-sdk-macosx/platform-tools/adb /usr/sbin/

You can then run the following command in the directory where you want to pull the file to

adb pull /data/anr/traces.txt

You should get some output showing that the transfer took place

3622 KB/s (245506 bytes in 0.066s)

Add comment