Search code examples
androidandroid-studiologcat

Get crash information when debugger is not attached?


I'm developing an app using Android Studio. Now I'm facing a bug where the app crashes when I do the following:

  1. Press the home button.
  2. Use the device for some 10 minutes (i.e. wait).
  3. Run the app again. Crash!

There is no easier way to reproduce the crash (nothing in onResume). As you can imagine, this is kind of hard to debug. In an ideal world, the OS (Android 5.0) would let me send a bug report to myself. The app is not published yet, so I don't see how I could get hold of the crash dump. Is it saved somewhere on the device?

I did try to debug the app from Developer Options, using the wait for debugger setting and then attaching to the process from within Android Studio. This, however, seems to make the bug go away. (The app is probably restarted.)

Q: How do I find the cause of the crash given these circumstances?


Solution

  • I found the crash using adb as described here. Never realized that logcat keeps logs from previous executions. Nice!