in Android, Programming

Your app crashes, live with it.


Let’s say that you are a developer that actually cares about the quality of his applications, yes, you belong to the 1%, so you are using BugSense to catch all the exceptions and you get something like this:

Full Stacktrace
0 android.database.sqlite.SQLiteDiskIOException: error code 10: disk I/O error
1 at android.database.sqlite.SQLiteStatement.native_execute(Native Method)
2 at android.database.sqlite.SQLiteStatement.execute(SQLiteStatement.java:55)
3 at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1881)
4 at android.webkit.WebViewDatabase.removeCache(WebViewDatabase.java:668)
5 at android.webkit.CacheManager.createCacheFile(CacheManager.java:430)
6 at android.webkit.WebViewWorker.handleMessage(WebViewWorker.java:134)
7 at android.os.Handler.dispatchMessage(Handler.java:99)
8 at android.os.Looper.loop(Looper.java:123)
9 at android.os.HandlerThread.run(HandlerThread.java:60)

You’re trying to figure out what is happening, how can this be your fault, especially when you are absolutely sure that you are not using SQLite in your project!
Well, I have good news for you, it’s not your fault, but then again I have bad news for you, even if you have done serious testing, shit happens and your application is going to crash, no matter what. And I mean it. It is going to crash. Even Gmail or Facebook crashes!

Trying to catch every possibility or corner case may lead to a large and complicated source code, leading to even more crashes. General exception handling on the other side will make your application slow, so make sure you keep the balance on this.

You cannot predict what the user will do, you cannot predict the behavior of the devices out there and allow me to make it more clear with 2 examples:

The Huawei IDEOS X5 constantly crashes with random Resources NotFound Exceptions.
The Sony Ericsson X10 mini simply does not run apps, they do not even start sometimes.

The list goes on and you must accept that your application will crash, what you can do is minimize the crashes that are your fault.

Your app crashes, live with it.

(Image from Wired.com)

Share