When an app suddenly closes with a "Unfortunately, AppName has stopped" dialog, the first place to look is the crash log. Android’s built‑in logging system – logcat – records every event, error, and stack trace that the operating system and apps emit. With the Android Debug Bridge (ADB) you can pull those logs from any device, even if you don’t have root access.
Logcat works at the kernel and framework level, so it captures crashes that the Play Store’s “Report” button may never send. Because it runs on the host PC, you can apply powerful text‑processing tools (grep, awk, sed) to isolate the exact exception, thread, and method that caused the failure. The workflow we’ll cover works on Android 6.0+ and on most OEM skins, without needing to enable developer‑only options beyond USB debugging.
adb shell pm list packages | grep -i appname.adb devices. You should see a line like 0123456789ABCDEF device. If you see unauthorized, unlock the phone and tap "Allow" on the USB‑debugging prompt.Open the app that is crashing and perform the action that triggers the failure. Keep the terminal open – we’ll start logcat before the crash so the stack trace is captured.
Run the following command, replacing com.example.app with the target package name:
adb logcat --pid=$(adb shell pidof -s com.example.app) *:E -v threadtime
This command does three things:
Leave this terminal window running. When the crash dialog appears, logcat will automatically dump the stack trace.
Instead of watching the stream, you can pipe it directly to a file for later review:
adb logcat --pid=$(adb shell pidof -s com.example.app) *:E -v threadtime > crash_log.txt
After the app crashes, press Ctrl +C to stop logging. The file crash_log.txt now contains the raw log.
Open the file with any text editor. The last few lines should include a FATAL EXCEPTION block, similar to:
04-12 14:23:45.678 1234 1234 E AndroidRuntime: FATAL EXCEPTION: main
04-12 14:23:45.678 1234 1234 E AndroidRuntime: Process: com.example.app, PID: 1234
04-12 14:23:45.678 1234 1234 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke …
…
If you don’t see a FATAL EXCEPTION line, the crash may have occurred in a native library. In that case, capture the full log (omit the *:E filter) and look for signal 11 (SIGSEGV) entries.
A typical crash block contains four key parts:
main.AndroidRuntime for Java crashes, or the native library name for C/C++ crashes.java.lang.IllegalStateException).Copy the full stack trace (including the at … lines) into your IDE’s search to jump directly to the offending source file.
Sometimes the app spawns background services that also generate errors, making the log noisy. Here are a few filters you can add to narrow the view:
adb logcat -s AndroidRuntime:E MyAppTag:W – shows only AndroidRuntime errors and warnings from your custom tag.adb logcat | grep -i "nullpointerexception" – useful when you only know the exception name.adb logcat -T "04-12 14:23:00.000" – starts logging from a specific timestamp, handy for long‑running sessions.If you need to share the crash log with a developer or a support forum, compress it first to preserve formatting:
zip crash_log_$(date +%Y%m%d_%H%M%S).zip crash_log.txt
Upload the zip to a trusted file‑sharing service or attach it to an email. Remember to redact any personal data that may appear in the log (e.g., device identifiers, user IDs).
adb kill-server && adb start-server then reconnect.adb shell ps | grep com.example.app to get the numeric PID and substitute it manually.*:E filter only after you’ve confirmed the crash is captured.-b radio or -b events to select a specific log buffer if you only need system events.adb logcat -v threadtime > full_log.txt.signal 11 (SIGSEGV) or Fatal signal 11. The lines following will point to the native library (.so) that crashed.If you already have Android Studio installed, you can capture logs without the command line:
The graphical view lets you apply the same filters (by tag, level, or PID) with a click, and you can copy the stack trace directly into the IDE for quick navigation.
adb shell pm list packages | grep -i myapp.adb logcat --pid=$(adb shell pidof -s com.mycompany.myapp) *:E -v threadtime > myapp_crash.txt.myapp_crash.txt, locate the FATAL EXCEPTION block, and copy the stack trace.*:E filter and search for signal 11.Following this checklist ensures you capture the exact moment the app fails, dramatically reducing the time spent guessing what went wrong.
adb logcat does not modify the device, but keep the screen unlocked to prevent the device from sleeping and cutting the log stream.With these steps you now have a reliable, repeatable method for capturing, exporting, and dissecting Android crash logs without ever rooting the phone. Whether you’re a developer debugging your own app or a power user helping a friend, logcat is the most transparent window into what Android is doing when things go wrong.









