Here are some of the common reasons why mobile apps crash.
Memory usage going beyond permissible levels. Solution is to ensure object reuse as much as possible. For example Table Cells can be reused to ensure the content that needs to be displayed at a given point in time is in the memory.
Memory leaks (stale objects hanging around). Make sure you use lists and static objects with care.
Unhandled exceptions. Make sure anticipated exceptions are handled properly.
Trying to access non-existent memory location. Make sure you have clear understanding of life time of the objects you create.
Well, how much ever testing you do it’s very difficult to cover all possible scenarios. This is much true in the case of mobile apps as they run in a variety of devices. Use tools like Crashlytics (Firebase Crashlytics | Crash Reporting to help you prioritize and fix stability issues faster (https://firebase.google.com/products/crashlytics) - for crashes), Finotes (Detect memory leaks, crashes, ANR, bugs in Android & iOS apps (https://finotes.com) - for crashes, memory leaks, memory usage issues, ANR, http issues), New Relic (New Relic | Deliver more perfect software (https://newrelic.com) - crashes, http issues) to capture bugs in live mobile apps so that you get to know them as and when it happens.
Top comments (2)
can we make our own embedded crash, ANR... classes inside the app without using other library?
You can do crash handling inside app, but ANR will be a challenge as doing that in production will drain the app's resources if not implemented right.