0

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?

l33t
  • 13,497
  • 13
  • 77
  • 159

3 Answers3

2

Try looking into your logcat and if that is not an option for you. try some crash analytic like the following.

https://mint.splunk.com/

Integrate it in your app just with a single line and whenever your app get crashed you will receive a mail of your crash logs..

it will easily help you to determine your crash scenario..

And just out of curiosity are you using any singlton class in your Activity.?

Nitesh
  • 3,550
  • 1
  • 17
  • 24
2

My intuition tells me that you are using some 'static' variables/fields in your application. When your app goes to background and it is not used, system could drop process (because of memory management) of this application from memory. When you come back, Application object and all application proces in system is recreated, so all static variables are cleared/reinitialized.

Am i right?

michal.luszczuk
  • 2,823
  • 1
  • 13
  • 21
0

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

Community
  • 1
  • 1
l33t
  • 13,497
  • 13
  • 77
  • 159