How to Fix “App Keeps Stopping” on Android — From Logs to Patch

Has your apk suddenly started crashing with “App keeps stopping”? I’ve been there — it’s frustrating for users and nerve-wracking for developers. The good news: most crashes are diagnosable and fixable with a systematic approach. Below I’ll walk you through a practical workflow (manual debugging + light automation) from gathering logs to shipping a safe patch. By the end you’ll know what to look for, how to test a fix, and how to release with minimum user pain. Let’s get it running again.
Quick checklist (TL;DR)
- Reproduce the crash.
- Capture logs with adb logcat.
- Identify the exception & stacktrace.
- Fix root cause (code, permissions, resources).
- Test on devices and Android versions.
- Roll out a staged update and monitor.
1) Reproduce the crash reliably
Before you change anything, make sure you can reproduce the crash consistently. Ask:
- Does it happen on app start, after login, or when opening a specific screen?
- Which Android versions and device models are affected?
- Does it happen only on fresh installs or also on upgrades?
Reproduction helps you confirm a fix actually works.
2) Capture logs — the developer’s flashlight
Connect a device (or use emulator) and run:
adb devices
adb logcat > full_log.txt
# or to show only errors:
adb logcat *:E
# To filter by app process (example):
adb logcat –pid=$(adb shell pidof -s com.example.pussy888)
Reproduce the crash and check the output for a Java exception or native crash (SIGSEGV). Look for lines like FATAL EXCEPTION, java.lang.NullPointerException, java.lang.IllegalStateException, or oom/OutOfMemoryError. The stacktrace points to the exact class and line.
3) Read the stacktrace — find the root cause
Stacktrace basics:
- Top-most Caused by: usually contains the exception type and message.
- The first non-framework line (e.g., com.yourapp.ui.MainActivity: line 142) is where to start.
Common causes and what to check:
- NullPointerException (NPE): Missing null checks, view binding issues, lifecycle misuse.
- Resources.NotFoundException: Missing drawable/string or wrong resource qualifiers.
- IllegalStateException: Wrong fragment transactions or UI actions off the main thread.
- OutOfMemoryError (OOM): Large bitmaps, memory leaks. Use smaller images or caching.
- SecurityException / Permission Denied: Missing runtime permission requests (esp. for Android 6.0+).
- Native crash (SIGSEGV): Problem in native libraries (NDK) or wrong ABI packaging.
- ClassNotFound / VerifyError: ProGuard/R8 obfuscation mismatch or minSdk/targetSdk issues.
4) Fixes mapped to causes
- NPE: Add null checks, use ViewBinding/findViewById safely, and guard asynchronous callbacks when activity is destroyed:
if (!isFinishing && !isDestroyed) {
// update UI
}
- Resources error: Confirm resource exists for target configuration (e.g., drawable-v24 vs drawable) and check build variants.
- Permission issues: Request runtime permissions and handle denial gracefully:
ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE), REQ)
- OOM: Use BitmapFactory.Options.inSampleSize or Glide/Picasso with proper resizing; fix memory leaks (use LeakCanary).
- Lifecycle race: Move heavy work to ViewModel/WorkManager and avoid UI updates after onStop().
- Native/ABI mismatch: Ensure .so files are built for required ABIs and packaged in apk.
- ProGuard/R8: Keep mapping file, add -keep rules for reflection-accessed classes.
5) Test across matrix & automate
Test on:
- Multiple Android versions (API levels), especially ones your users use.
- Different device configurations (low memory, slow CPU).
- Fresh install vs upgrade scenarios.
Automate with Firebase Test Lab or a small device farm. Add unit tests and instrumentation tests that reproduce the failing flow.
6) Build, sign, and stage the patch
When the fix is validated:
- Bump version code & name.
- Build a signed release APK/AAB.
- Use staged rollout (Google Play) or phased release on your distribution site to limit impact. For direct APK distribution, upload the patched file to your landing page — and mark it as the fixed version with release notes. (Make sure the link you provide to users points to the updated, signed package.)
Pro tip: keep a mapping of previous ProGuard/R8 mapping files for deobfuscation of future crashes.
7) Monitor and iterate
After release:
- Monitor crash reports (Firebase Crashlytics, Sentry, or your own logging).
- Watch ANR (Application Not Responding) and crash-free user metrics.
- If the crash rate doesn’t decline, revert the change or push a hotfix.
8) Communication is part of the fix
Tell users what you fixed. A short note like “Fixed crash on launch for Android 11 — update recommended” reduces support volume and rebuilds trust. If the issue was upgrade-related, give explicit instructions (clear cache/data or reinstall).
Conclusion
Crashes are unpleasant but solvable. With a repeatable workflow — reproduce, log, diagnose, patch, test, and monitor — we minimize user disruption and ship safer updates. If you want, I can draft a short checklist or a sample adb script to automate log capture and stacktrace extraction for the pussy888 apk release.