Diagnosing and Fixing Android App Crashes with Logcat and Safe Mode
12 min read
Learn a step‑by‑step method to capture crash logs with Logcat, isolate problematic apps using Safe Mode, and resolve common Android app crashes without root.
October 13, 2026 06:30
When an app suddenly closes with a “Force Close” or “Unfortunately, app has stopped” message, it can feel like a dead end. Most crashes leave a trace in the system log, and Android’s Safe Mode lets you verify whether the problem is caused by that app itself or by a conflicting third‑party component. This guide shows you how to capture those logs with logcat, interpret them, and apply the right fix – all without rooting your device.
Before you start
- Charge your phone to at least 50 % – a lost connection during debugging can corrupt logs.
- Use a USB‑C or micro‑USB cable that supports data transfer, not just charging.
- Have a computer with ADB installed. If you don’t, follow a quick download of the platform‑tools package and unzip it to a folder you can access from the command line.
- Make sure your device is running Android 6.0 (Marshmallow) or newer – the steps are stable across versions, though wording may differ slightly on custom skins.
Step 1 – Enable Developer Options and USB debugging
- Open Settings → About phone.
- Tap Build number seven times. You’ll see a toast: “You are now a developer!”.
- Return to the main Settings page. A new entry Developer options appears.
- Enter Developer options and toggle USB debugging on. Confirm any security prompt.
Why this matters: USB debugging opens a communication channel that lets ADB request log data from the device.
Step 2 – Verify ADB connection
- Connect the phone to your computer via the data cable.
- Open a terminal (Command Prompt, PowerShell, or a Linux shell) and navigate to the folder where you extracted the platform‑tools.
- Run
adb devices. You should see a device serial number followed by device.
- If you see
unauthorized, look at your phone – a dialog asks you to allow USB debugging. Tap Allow and optionally check “Always allow”.
- If no device appears, try a different cable or enable “USB for file transfer” in the notification shade.
Step 3 – Capture the crash log with Logcat
Logcat streams every system event, but we only need the portion that occurs during the crash.
- In the terminal, start a fresh log buffer and write it to a file:
adb logcat -c
- Launch the app that crashes and reproduce the error (e.g., open a specific screen, tap a button, etc.).
If the app instantly force‑closes, you’ll see the error appear on screen.
- Immediately stop the log capture and save the output:
adb logcat -d > crash_log.txt
- Open
crash_log.txt with any text editor. Look for lines containing E/AndroidRuntime or the tag FATAL EXCEPTION. Those lines pinpoint the offending class and exception type.
What you should see: a block similar to
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.app, PID: 12345
java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference
at com.example.app.ui.MainActivity.onCreate(MainActivity.java:45)
...
The stack trace tells you which class (MainActivity) and line (45) threw the exception. Even if you’re not a developer, the exception type (e.g., NullPointerException) hints at the root cause – often a missing permission, corrupted data, or an outdated library.
Step 4 – Use Safe Mode to isolate third‑party interference
Sometimes the crash isn’t caused by the app itself but by another app that injects code (e.g., a battery optimizer or a theme engine). Safe Mode boots Android with only the core system apps, disabling all third‑party packages.
- Press and hold the power button until the power menu appears.
- Long‑press the Power off option. A prompt will ask if you want to reboot into Safe Mode – confirm.
- The device restarts and you’ll see “Safe mode” in the corner of the screen.
- Open the problematic app again.
- If the app works, a third‑party app is likely the culprit. Proceed to the troubleshooting section to identify it.
- If it still crashes, the issue lies within the app or the OS itself.
Warning: Safe Mode disables all custom keyboards, launchers, and accessibility services. If you rely on a third‑party keyboard, you’ll need to switch back to the default Gboard before typing.
Step 5 – Apply the appropriate fix
Based on the log analysis and Safe Mode result, choose one of the following actions.
5.1 Clear app data or cache
- Settings → Apps → Problematic App → Storage → Clear cache.
If the crash persists, tap Clear storage / Clear data. This removes corrupted files but also resets the app’s settings.
- Warning: clearing data deletes login credentials and offline content. Make sure you know your account passwords.
5.2 Reinstall or update the app
- Uninstall the app via Settings → Apps → Uninstall, then reinstall from the Play Store or a trusted APK source.
- If the app is already up‑to‑date, check the developer’s “What’s new” notes for bug‑fix mentions.
5.3 Update Android system components
- Go to Settings → System → System update. Install any pending security patches or OS updates. Many crashes stem from mismatched API levels.
5.4 Disable or uninstall conflicting third‑party apps (Safe Mode identified)
- Boot normally, then open Settings → Apps.
- Sort apps by “Last used” or “Installed”.
- Temporarily disable apps you suspect (e.g., battery savers, theming engines) by tapping Disable.
- Re‑test the problematic app. Re‑enable the disabled app once the issue is resolved.
5.5 Use ADB to force‑stop a stubborn app
If the app refuses to close, run:
adb shell am force-stop com.example.app
This can clear a lingering process that may be holding corrupted state.
Troubleshooting common roadblocks
- No log output: Ensure you cleared the log buffer (
adb logcat -c) before reproducing the crash. Some OEMs filter logs in release builds; you may need to enable “Verbose logging” in Developer options (Settings → Developer options → Logger buffer size → “4 M”).
- Device not listed by
adb devices: Try restarting the ADB server with adb kill-server && adb start-server, use a different USB port, or enable “USB debugging (Security settings)” on devices with a work profile.
- Logcat shows only system messages, no app tag: The app may be crashing in native code (C/C++). Look for lines with
SIGSEGV or native crash. In such cases, updating the app or the OS is the most reliable remedy.
- Safe Mode still crashes: The bug is likely in the app itself or a core Android component. Report the stack trace to the app developer via the Play Store “Contact developer” link.
Alternative ways to capture logs
If you prefer a graphical interface, the following options work without a full ADB setup:
- Android Studio: Connect the device, open the Logcat pane, reproduce the crash, then copy the filtered output.
- MatLog (Play Store): A lightweight log viewer that can save logs locally. Note that on Android 10+ it may require the “Read logs” permission, which only system apps can grant – so its usefulness varies by OEM.
When to seek further help
If you’ve tried the steps above and the crash persists, consider the following:
- Search the exact exception text (e.g., “NullPointerException at com.example.app.ui.MainActivity”) on the developer’s issue tracker or forums.
- Provide the full Logcat snippet when contacting support – it’s the most actionable piece of information.
- In rare cases, a hardware issue (faulty RAM) can manifest as repeated native crashes. Running a hardware diagnostic app from the manufacturer can confirm this.
With a clear log, Safe Mode verification, and the appropriate fix, you’ll turn a frustrating “Force Close” into a solved problem – and you’ll have a repeatable workflow for any future app crashes.