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
- Your guide to reducing your Android ANR rate and improving your users’ experience
Your Guide to Reducing your Android ANR Rate and Improving your Users’ Experience | Unity
Unite Talk
- Best practices for reducing ANRs on Android | Unite 2024
https://www.youtube.com/watch?v=pezwIhA0e04
Webinars
- Best Practices for Reducing ANRs on Android with Unity (AMER)
Fireside chat covering common ANR scenarios, profiling techniques, and engine-level considerations.
Unity Fireside Chat - Unity Learn - Best Practices for Reducing ANRs on Android with Unity (EMEA)
A Pro Hour webinar recording that dives into similar best practices with region-specific insights.
Unity Pro Hour - Webinar Recordings - Unity Learn
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.
- Debug ANRs in Unity Games
Learn how Android detects ANRs and how to investigate them using logs, traces, and tooling.
https://developer.android.com/games/engines/unity/unity-anrs - Common Unity Game ANRs
A curated list of frequent ANR patterns seen in Unity games, including startup, rendering, and lifecycle issues.
https://developer.android.com/games/engines/unity/unity-anrs-list - Symbolicate Android Crashes and ANRs for Unity Games
Essential for turning native stack traces into readable, actionable information.
https://developer.android.com/games/engines/unity/unity-symbolicate - Debug Low Memory Issues
Proper memory management is crucial for preventing ANRs because excessive memory usage or frequent garbage collection can stall the main thread, causing the app to become unresponsive.
https://developer.android.com/games/engines/unity/unity-lmks
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.
- Tackling profiling for mobile games with Unity and Arm
Tackling profiling for mobile games with Unity and Arm - Optimizing Unity Games for Arm
https://developer.arm.com/mobile-graphics-and-gaming/unity - Profiling Unity apps on Android
Profiling Unity apps on Android | Arm Learning Paths
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.
- Ultimate guide to profiling Unity games (Unity 6 edition)
https://unity.com/resources/ultimate-guide-to-profiling-unity-games-unity-6 - Optimize your game performance for mobile, XR, and the web in Unity (Unity 6 edition)
https://unity.com/resources/mobile-xr-web-game-performance-optimization-unity-6 - Mobile optimization tips for technical artists
https://unity.com/how-to/mobile-game-optimization-tips-part-1 - Sprite Atlas Analyzer
Get started with Sprite Atlas Analysis | 2D Tooling | 2.0.0 - Sprite Atlas best practices in Unity 6
https://www.youtube.com/watch?v=hXlpnwD-TgY
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.
