Understanding and Preventing ANRs in Android Games Built with Unity

Understanding and Preventing ANRs in Android Games Built with Unity

Application Not Responding (ANR) errors are one of the most common and most damaging issues affecting Android games. For Unity developers shipping on Android, understanding what causes ANRs and how to prevent them is critical to maintaining performance, player satisfaction, and store visibility.

Below, we will highlight why they matter and key Unity and Android resources to help you debug and reduce them. We’ll also look at what we are doing in Unity 6 to help proactively identify and fix ANR-related issues using Project Diagnostics.


What Are ANRs and Why Do They Matter?

An ANR (Application Not Responding) occurs when an Android app fails to respond to user input within a defined time window, typically because the main thread is blocked for too long. This can happen during heavy computation, synchronous I/O, long startup times, or poorly managed lifecycle events.

ANRs are harmful because they:

  • Trigger system dialogs that interrupt gameplay
  • Lead to forced app closures
  • Negatively impact Google Play ratings and reviews
  • Can reduce store discoverability and retention

In short, frequent ANRs signal poor responsiveness, and players notice.


Unity Resources: Best Practices for Reducing ANRs

My team has published several in-depth learning resources focused on preventing ANRs in Android games. These sessions break down real-world causes and offer practical guidance tailored to Unity developers.

Blog Posts

Unite Talk

Webinars


Android Developer Documentation for Unity

In collaboration with Google, we have provided excellent Unity-specific Android documentation that complements Unity’s guidance, especially for debugging and root-cause analysis.

These resources are especially useful when working with native plugins, IL2CPP builds, or engine-level threading issues.


ARM Documentation for Unity

We have also collaborated with ARM to deliver meaningful insights for performance profiling on Android using Unity.


What’s New in Unity 6: Proactive ANR Detection with Unity and Project Diagnostics

With the release of Unity 6, we’ve significantly expanded our observability and diagnostics capabilities, helping developers catch performance and responsiveness issues earlier in the development cycle.

Adaptive Performance

Improvements to Adaptive Performance were made. It is a tool you can use to automatically adjust application quality based on real-time thermal and power state, ensuring consistent performance and preventing thermal throttling.

Learn more here:

Project Auditor

Project Auditor is a suite of static analysis tools for Unity projects. It reports insights and issues about the scripts, assets, and code in your project, and groups insights into a report that you can view in the dedicated Project Auditor window.

Learn more here:

Capture ANR Insights in Real Time with IApplicationExitInfo

IApplicationExitInfo is an Android-specific Unity interface that provides detailed information about why your application was terminated. It allows developers to inspect exit reasons, including ANRs, crashes, or system-initiated kills, giving valuable context for post-mortem analysis.

Using IApplicationExitInfo, you can:

  • Identify whether a previous app exit was due to an ANR

  • Access system-provided exit codes and timestamps

  • Integrate this information into your analytics or diagnostic workflows

By leveraging this interface, Unity developers gain better visibility into runtime issues, helping them pinpoint the root cause of unresponsiveness and add actionable data whenever an ANR occurs.

Learn more here:

https://docs.unity3d.com/Documentation/ScriptReference/Android.IApplicationExitInfo.html

Project Diagnostics

Project Diagnostics, part of the Developer Data framework, provides free automated insights into your project configuration and runtime behavior. It helps identify potential problem areas that can contribute to ANRs, such as:

  • Blocking operations on the main thread
  • Inefficient startup flows
  • Misconfigured project or platform settings
  • Patterns known to cause performance stalls on Android

By surfacing issues earlier, often before they reach production, Project Diagnostics helps teams take a preventative approach instead of reacting to ANRs after release. Below are sample screenshots showing the types of data currently being reported.

You can learn more here:

Additional Resources

ANRs are often caused by overall game performance. Here are some additional resources to help you understand how to improve mobile game performance and avoid triggering ANRs.

I hope you find these resources helpful. Please continue to monitor this post, as we will be sharing additional ANR-related resources in the near future. If you have any questions or comments, feel free to post them in this thread, and we will be happy to respond.

2 Likes