Abstract
Mobile apps have become ubiquitous. For app developers, it is a key priority to ensure their apps' correctness and reliability. However, many apps still suffer from occasional to frequent crashes, weakening their competitive edge. Large-scale, deep analyses of the characteristics of real-world app crashes can provide useful insights to guide developers, or help improve testing and analysis tools. However, such studies do not exist -- this paper fills this gap. Over a four-month long effort, we have collected 16,245 unique exception traces from 2,486 open-source Android apps, and observed that framework-specific exceptions account for the majority of these crashes. We then extensively investigated the 8,243 framework-specific exceptions (which took six person-months): (1) identifying their characteristics (e.g., manifestation locations, common fault categories), (2) evaluating their manifestation via state-of-the-art bug detection techniques, and (3) reviewing their fixes. Besides the insights they provide, these findings motivate and enable follow-up research on mobile apps, such as bug detection, fault localization and patch generation. In addition, to demonstrate the utility of our findings, we have optimized Stoat, a dynamic testing tool, and implemented ExLocator, an exception localization tool, for Android apps. Stoat is able to quickly uncover three previously-unknown, confirmed/fixed crashes in Gmail and Google+; ExLocator is capable of precisely locating the root causes of identified exceptions in real-world apps. Our substantial dataset is made publicly available to share with and benefit the community.
Introduction
Despite a decade of development, Android apps still suffer from frequent crashes that frustrate users and damage brand reputation. While many tools exist to detect bugs, developers still fail to resolve nearly 40% of reported crashes. This research presents the first large-scale empirical study of Framework-Specific Exceptions (FSEs)—crashes triggered within the Android framework due to app-level violations.
Unlike "application exceptions" which stem from errors in the app's own logic, FSEs occur when an app violates a constraint enforced by the Android system, such as updating the UI from a background thread or mishandling a database cursor. Because these crashes involve complex interactions between app code and the massive Android framework, they are notoriously difficult to reproduce, localize, and fix.
Methodology
The study involved a comprehensive investigation spanning ten person-months, utilizing a multi-pronged approach to data collection and analysis.
The researchers built a web crawler to extract 7,764 exception traces from GitHub and Google Code, and supplemented this by running three state-of-the-art testing tools (Monkey, Sapienz, and Stoat) on 4,560 app versions to generate 13,271 additional crashes. The final dataset comprises 16,245 unique exception traces from 2,486 open-source F-Droid apps. From this pool, 8,243 FSEs were manually inspected to construct a taxonomy of 11 common fault categories.
Key Findings and Insights
The analysis revealed that FSEs are the "silent majority" of Android crashes, affecting over 75% of projects. Notably, FSEs take twice as long to fix as standard application exceptions and have a significantly lower fix rate (53% vs 67%).
As shown in the figure above, most FSEs cluster around three primary Android modules: App Management (lifecycle issues), Database (SQLite errors), and OS (permission and thread constraints).
A critical finding is the "blindness" of current static analysis tools. Popular tools like FindBugs, PMD, and SonarQube failed to report any warnings for a sample of 75 real-world FSEs, while Android-specific Lint caught only 5%. This is largely because FSEs are context-dependent; they often arise from code running at the wrong time (e.g., a callback firing after an Activity is destroyed), which static tools struggle to detect without runtime context.
Results and Applications
The study identified 11 fault categories and four primary fix patterns that resolve over 80% of FSEs: refining conditional checks, moving code to the correct thread, utilizing proper lifecycle callbacks, and adjusting implementation choices. To demonstrate the practical utility of these findings, the authors optimized the dynamic testing tool Stoat, which successfully uncovered three previously unknown crashes in Gmail and Google+, and developed ExLocator, a prototype tool capable of localizing the root cause of an FSE with 92% precision.
Conclusion
This large-scale study highlights the prevalence and complexity of Framework-Specific Exceptions in Android development. The findings underscore a significant gap in current bug detection tools and provide a roadmap for future research in automated patching and enhanced static analysis rules tailored to the Android lifecycle. The substantial dataset has been made public to benefit the broader research community.
Summary updated