Why do mobile applications crash?

Mobile devices have become an indispensable part of our everyday lives, mastering our on-line transactions and influencing our communication with others. However, most smartphone users experience application crashes once in a while. A crash manifests when, for example, you are using your favorite application and it suddenly stops working properly or closes. Sometimes, this can be really troublesome, especially when you try to send an important message or proceed with a financial transaction. There are many reasons that can lead mobile applications to crashes—and the causes are not always tractable. This blog entry discusses the causes of application crashes in mobile devices, based on the examination of a corpus of crash reports from Android applications [1].

In brief, mobile devices’ architecture mainly consists of a software platform (i.e. kernel, operating system, libraries, and Application Programming Interfaces -APIs) that is responsible for: a. the communication of the device with the external world (through resource management, networking, power management, and drivers), b. the main functionality of the device (e.g. contacts, phone, and browser), and c. the hosting of third-party applications. The stability of these applications depends on several parameters including: 1) the context under which the applications run, 2) the quality of the applications’ source code, and 3) the design and implementation of the APIs that the applications rely on.

The context refers to runtime characteristics able to affect the stability and performance of an application. Such characteristics can be related to device specifications (memory, processor, and power) and other applications that run at the same time on our device. The prevention of crashes associated with the context can be quite difficult. This occurs because of the amount of the different devices that exist in the market and the number of the unpredictable situations that can occur at runtime.

However, developers can reduce the number of their applications’ crashes, by writing well-designed programs and high-quality source code. For instance, even though mobile devices can have restricted memory, careful developers can use low memory consuming resources to keep their applications concise and light. API designers can also affect applications’ stability, since they provide developers with guidelines for the building of their programs. This means that well-designed APIs can improve the responsiveness of the applications that are based on them (for more information see the previous post: API evaluation.)

In a study I recently conducted with my colleague Dr. Dimitris Mitropoulos and my supervisor Prof. Diomidis Spinellis, we examined problematic calls to methods of the Android API from client applications. (An early version of our insights can be found in [1].) We argue that the referred problems could manifest because of implementation issues within the applications, as well as because of design and implementation issues in the API methods. As Figure 1 shows, we found that the most crashes came from out of memory, synchronization issues, and missing resources regarding insufficient declaration of resources (e.g. layouts). Many problems also came from implementation problems such as indexing problems and invalid format or syntax, as well as connectivity, and security issues. Finally, we found a significant amount of crashes that stem from bad API documentation (Unclassified).

Figure 1: Crash cause categories (from [1])

Figure 1: Crash cause categories (from reference [1])

Finally, I refer to some suggestions for the handling of the above categories. To prevent application crashes from memory exhaustion and synchronization issues (related to context issues) developers can use tools such as memory analyzers, profilers, and model checkers. To handle crashes due to missing resources programmers can use static tools and API designers can include default resources in their APIs. For indexing, invalid format or syntax problems and security issues developers can use static analysis tools and API designers can provide more precise documentation (e.g. for permissions). For connectivity issues developers can use stress tests and for crashes with unclear causes (that have runtime exceptions and errors) API designers could provide better documentation to help developers recover from unexpected failed executions of their programs.

[1] Maria Kechagia, Dimitris Mitropoulos, and Diomidis Spinellis. Improving the quality of APIs through the analysis of software crash reports. In Andrew V. Jones and Nicholas Ng, editors, 2013 Imperial College Computing Student Workshop, volume 35 of OpenAccess Series in Informatics (OASIcs), pages 57-64, Dagstuhl, Germany, 2013. Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik.

Leave a Reply

Your email address will not be published. Required fields are marked *