Click here to Skip to main content
13,793,706 members
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

3.9K views
6 bookmarked
Posted 9 Oct 2018
Licenced CPOL

Investigating an App Crash with Android vitals

, 9 Oct 2018
In this post, we’ll look at how Android vitals can help in this process by detecting and fixing app crashes in order to improve quality and deliver a pleasing user experience.

Editorial Note

This article is in the Product Showcase section for our sponsors at CodeProject. These articles are intended to provide you with information on products and services that we consider useful and of value to developers.

Your app is finally live on the Play Store. Congratulations!

But the development process is not entirely over. How is your app being used? What problems are your users facing? Is that nice-looking button responding to clicks? Does your app start up fast enough to please your users? And most importantly, how can you tell how well your app is performing on users’ devices?

These are all essential questions to answer if you want to ensure your app’s success in the crowded, competitive Play Store. In this post, we’ll look at how Android vitals can help in this process by detecting and fixing app crashes in order to improve quality and deliver a pleasing user experience.

Google Play has a myriad of tools that help Android developers build quality apps, grow their user base, and generate revenue. Building quality successful apps takes time and requires a great deal of effort. With this in mind, Android vitals was added to Play Console to provide data on key metrics relating to app stability and performance. With this data, developers get to know exactly where they need to focus their efforts to improve the quality of their apps.

Why Care About Performance?

It’s no secret: Stellar app performance leads to higher app ratings, which in turn leads to a higher number of installs. Users pay attention to app reviews and ratings on the Play Store. Bad app performance rarely goes unnoticed. It doesn’t take much thought for users to abandon or completely delete poorly performing apps, because the Play Store is rife with several alternatives. In fact, independent reports by Google and AppDynamics affirm that poor-performing apps get deleted sooner rather than later, and receive lower ratings. To thrive on the Play Store, it’s imperative developers ensure their apps are of high quality and deliver the best experience.

For paid apps and games, performance is even more crucial. Users will demand value for their money. Performance largely drives the success of these apps and the revenue developers are able to generate from users. For games, users are even less tolerant of bad app behaviors—including crashes, battery drainage, and slow response time. Nobody likes a game that crashes randomly, drains the battery, or inconsistently responds to input.

The need to build apps with great performance can’t be emphasized enough.

Android Vitals

Tracking app performance once an app is live is a daunting task. However, Android vitals makes the process truly effortless. Android vitals collects and aggregates data from users in a meaningful way, giving developers unmatched insights into how their app is performing on users’ devices.

*Note that Android vitals only collects data from users who have activated the Usage & Diagnostics sharing feature.

Collected Data Types

Android vitals collects data and reports on the following broad categories:

  • Stability

    For stability, Android vitals reports on Application Not Responding (ANR) and crash rate. An ANR occurs when an app’s UI thread is blocked for a long period. Users are given the option to quit or wait when an ANR occurs. Crashes, on the other hand, occur as a result of unhandled exceptions.

  • Battery Usage

    Battery power is a limited resource—Therefore, it should be managed with care. Apps that use the CPU extensively quickly drain the battery. For this category, Android reports on wake locks, wakeup, and network usage. Wake locks, wakeups, and excessive network usage keep a user’s device busy, and as a result, affect battery life.

  • Startup Time

    Users expect apps to load reasonably fast. Apps that take too long to load are perceived as unresponsive and ruin the user experience. Android vitals provides information on the various startup states: cold, warm, and hot start.

  • Render Time

    Smooth user interaction (60 frames per second) is the target. Vitals reports on apps that take longer to render and apps with frozen frames (render time greater than 700ms).

  • Permission

    To protect users, Android requires apps to obtain permission from users before doing anything sensitive. Prior to the new Runtime permission format, users had to grant all permissions at the time of install. This introduced some security risks. In the new permission format, users get to allow or deny permissions at runtime. Android vitals provides information on permission denials.

Read more on each metric here.

How Does Android Vitals Compare to Other Tools?

Android vitals provides functionalities similar to other third-party tools. It is unique in several ways, too.

One key thing you’ll notice is that Android vitals requires zero effort to set up. You don’t need to add any code to your app—not even a single variable. All that is required is that users opt-in to share usage and diagnostics information. You also don’t need a dedicated account to manage. Android vitals is available from the Google Play Console, which you already use for managing your apps.

Apps may crash even before users get to see the user interface. For third-party tools, these crashes are almost impossible to detect because the crash reporting library was probably not initialized when the crash occurred. With Android vitals, however, these crashes are captured and reported. Additionally, Android vitals allows developers to compare their app performance to other apps for each metric. Developers also get notified when their app’s performance drops significantly compared to other apps in the same category, giving developers the opportunity to quickly fix the issue.

Even when you use other crash reporting tools, you should rely on Android vitals so you can quickly identify and fix performance bottlenecks in your app.

Investigating an App Crash

To view the Android vitals dashboard, select your app from the Google Play Console. From the left menu, select Android vitals, then Overview.

The Overview page displays the core vitals (crashes, excessive wakeups, ANRs, stuck partial wake locks) at the top. These metrics are found to be more critical to app performance. Information on all metrics is provided on the Overview page, with filtering available. Drill deeper into any metric by clicking on View Details.

It is important to note that Android vitals displays this information only when enough data has been gathered. So some apps will not have any stats shown. This may result from users not sharing usage and diagnostics information, or apps not using features that trigger performance-critical behaviors.

Catch the Crash

All crashes are not the same. While some are fairly easy to catch, others are notoriously hard to pinpoint. Nonetheless, once you identify the source of a crash, debugging becomes a lot easier.

App crashes and ANRs have a dedicated section under the Android vitals menu. To view real-time crash information, select CRASHES under ANRs & Crashes. App crashes are shown in clusters with the number of reports and impacted users displayed to the side. You also have the ability to filter the data based on Android version, time period, app version, and app install source.

Select the crash cluster of interest to delve deeper into the crashes reported. A detailed view should be shown. From this page, you can see the type of exception that occurred, the number of reports, and the impacted users for each crash. You also get stats on the app version, Android version, and even a list of devices on which the crash occurred. One great feature is that you can view some basic information about the device type (such as RAM), which may yield additional insight into the crash.

At the bottom of the page, you have access to the crash logs. The logs reveal the kind of exception that occurred and its source in the app. Though not always the case, this should give you a fair clue of some possible actions that will fix the issue. For a simple crash, this could involve only moving a chunk of code into a try-catch block, just like in the image above.

What Next?

There’s no definitive solution for fixing app crashes. However, the following might come in handy when dealing with app crashes.

  • Use a good crash reporting tool like Firebase Crashlytics alongside Android vitals to gain deeper insights into app crashes.
  • Try Kotlin. Kotlin is officially supported on Android and is fully interoperable with Java. Kotlin’s type system helps eliminate NullPointerExceptions, which are a source of headaches for many developers. Many popular apps have been built using Kotlin, including Slack and busuu.
  • Use Android Jetpack. Jetpack offers Android developers a collection of components to quickly build robust, quality apps. These components ensure developers follow best practices and reduce the chance of errors in apps.
  • Read documentation for Android best practices and guidelines. Although this may not directly help fix a crash, you’ll get expert tips on how to avoid crashes and improve app performance.

Closing Thoughts

As we’ve seen, app performance and stability are crucial to finding success on the Play Store. Android vitals helps you reach this goal with minimal effort on your part, and at zero cost. With additional features on the roadmap, you can only expect better ways to improve app performance.

If you’ve never checked your app’s vitals, head over to your Play Console to see exactly how your app is performing and all the red flags you’ve been missing, and let the information inform your decisions. For all you know, your users need an urgent fix to one of your vitals, not another fancy change to the user interface.

To learn more about Android vitals, do check out the guide. Enjoy improving your app’s performance and user experience.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Bruno Edoh
United States United States
No Biography provided

You may also be interested in...

Comments and Discussions

 
-- There are no messages in this forum --
Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web06 | 2.8.181207.3 | Last Updated 9 Oct 2018
Article Copyright 2018 by Bruno Edoh
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid