스택 트레이스에 libil2cpp.so 라이브러리의 함수가 표시되면 C++로 변환되는 C# 코드에서 오류가 발생한 것입니다. libil2cpp.so 라이브러리에는 게임 코드뿐만 아니라 플러그인과 패키지도 있습니다.
C++ 파일 이름은 Unity 프로젝트에 정의된 어셈블리 이름을 따릅니다.
그렇지 않으면 파일 이름에 기본 어셈블리-C# 이름이 지정됩니다. 예를 들어 그림 3에는 어셈블리 정의 파일에 정의된 이름인 파일 Game.cpp의 오류가 표시됩니다 (파란색으로 강조 표시됨). Logger은 C# 스크립트의 클래스 이름 (빨간색으로 강조 표시됨)이고 그 뒤에 함수 이름 (녹색으로 강조 표시됨)이 나옵니다. 마지막은 IL2CPP 변환기가 생성한 전체 이름입니다 (주황색으로 강조 표시됨).
그림 3. Backtrace의 테스트 프로젝트 호출 스택
다음을 실행하여 게임 코드를 검사합니다.
C# 프로젝트에서 의심스러운 코드를 검사합니다. 일반적으로 C# 처리되지 않은 예외는 ANR이나 애플리케이션 비정상 종료를 일으키지 않습니다. 그렇더라도 다양한 상황에서 코드가 올바르게 실행되는지 확인하세요. 코드가 서드 파티 엔진 모듈을 사용하는지 확인하고 최근 출시에서 오류가 발생했는지 분석합니다. 또한 최근에 Unity를 업데이트했는지 또는 특정 기기에서만 오류가 발생하는지 검토합니다.
게임을 Android 스튜디오 프로젝트로 내보냅니다. 게임의 변환된 C# 소스 코드에 대한 전체 액세스 권한을 사용하면 ANR을 일으키는 함수를 찾을 수 있습니다. C++ 코드는 C# 코드와 매우 다르며 코드 변환에 문제가 발생하는 경우는 드뭅니다. 문제를 발견하면 Unity에 지원 티켓을 제출하세요.
Android vitals 또는 다른 보고 서비스 기록을 분석하고 오류가 가장 많이 발생하는 게임의 출시 버전을 확인합니다. 버전 관리 기록에서 소스 코드를 검토하고 출시 간 코드 변경사항을 비교합니다. 의심스러운 항목이 발견되면 각 변경사항 또는 잠재적 수정사항을 개별적으로 실험해 보세요.
ANR이 가장 많이 발생하는 기기 및 Android 버전의 Google Play ANR 보고 기록을 검토합니다. 기기나 버전이 오래된 경우 게임의 수익성에 영향을 미치지 않는다면 무시해도 됩니다. 특정 사용자 그룹이 더 이상 게임을 플레이할 수 없으므로 데이터를 주의 깊게 살펴보세요. 자세한 내용은 배포 대시보드를 참고하세요.
게임 소스 코드를 검토하여 문제를 일으킬 수 있는 코드를 호출하지 않는지 확인합니다. 예를 들어 finish는 올바르게 사용하지 않으면 파괴적일 수 있습니다. Android 개발에 대해 자세히 알아보려면 Android 개발자 가이드를 참고하세요.
아무것도 찾을 수 없다면 버그를 신고하여 문제를 해결하세요. 엔진 엔지니어가 오류를 더 잘 이해하고 해결할 수 있도록 심볼화된 스택 트레이스를 제공합니다.
최신 Unity LTS에서 문제와 관련된 개선사항이 있는지 확인합니다. 이 경우 해당 버전을 사용하도록 게임을 업그레이드하세요. (이 솔루션은 일부 개발자에게만 가능할 수 있습니다.)
코드가 기본값 대신 맞춤 Activity를 사용하는 경우 Java 코드를 검토하여 활동으로 인해 문제가 발생하지 않는지 확인합니다.
서드 파티 SDK
모든 서드 파티 라이브러리가 최신 상태이고 최신 버전의 Android에서 비정상 종료 또는 ANR 보고가 없는지 확인합니다.
Unity 포럼으로 이동하여 최신 버전에서 오류가 이미 해결되었는지 또는 Unity나 커뮤니티 회원이 해결 방법을 제공했는지 확인합니다.
Google Play ANR 보고서를 검토하고 오류가 아직 Google에서 식별되지 않았는지 확인합니다. Google은 일부 ANR을 인지하고 있으며 해결하기 위해 적극적으로 노력하고 있습니다.
시스템 라이브러리
시스템 라이브러리는 일반적으로 개발자가 제어할 수 없지만 ANR의 상당 부분을 차지하지는 않습니다. 라이브러리 개발자에게 문의하거나 로그를 추가하여 문제를 좁히는 것 외에는 시스템 라이브러리 ANR을 해결하기가 어렵습니다.
종료 이유
ApplicationExitInfo는 ANR 원인을 파악하기 위한 Android API입니다.
게임에서 Unity 6 이상을 사용하는 경우 ApplicationExitInfo를 직접 호출할 수 있습니다. 이전 Unity 버전의 경우 Unity에서 ApplicationExitInfo 호출을 사용 설정하려면 자체 플러그인을 구현해야 합니다.
Crashlytics도 ApplicationExitInfo를 사용하지만 자체 구현을 사용하면 더 세부적으로 제어할 수 있고 더 관련성 높은 정보를 포함할 수 있습니다.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-08-26(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-08-26(UTC)"],[],[],null,["Solving [ANRs](/topic/performance/vitals/anr) in your Unity game is a systematic process:\n**Figure 1.** Steps to solve ANRs in Unity games.\n\nIntegrate reporting services\n\nReporting services such as [Android vitals](/topic/performance/vitals), [Firebase\nCrashlytics](https://firebase.google.com/products/crashlytics), and [Backtrace](https://backtrace.io/) (a certified Unity\npartner) provide error logging and analysis for your game at scale. Integrate\nreporting services SDKs into your game early in the development cycle. Analyze\nwhich reporting service best fits your game needs and budget.\n\nDifferent reporting services have different ways of capturing ANRs. Include a\nsecond reporting service to increase the chance of obtaining valid data to\nsupport your decision in fixing ANRs.\n\nIntegrating reporting SDKs doesn't impact game performance or APK size.\n\nAnalyze symbols\n\nAnalyze the reports from your reporting service and check\nwhether the stack traces are in human-readable format. See [Symbolicate Android\ncrashes and ANR for Unity games](/games/engines/unity/unity-symbolicate) for more information.\n**Figure 2.** Crashlytics showing build ID and missing `libil2cpp.so` symbols.\n\n**How to check symbol build ID**\n\nIf the reporting system shows the missing build ID but the build symbols still\nexist in the build machine storage, it's possible to check the build ID of the\nsymbols and then upload them to the reporting service. Otherwise, a new build is\nrequired to upload the symbol files.\n\nOn Windows or macOS:\n\n1. Navigate to the symbols folder based on your [scripting\n backend](https://support.unity.com/hc/en-us/articles/115000292166-Symbolicate-Android-crash) (see **Resolution** :)\n 1. Use the following command (on Windows, use [Cygwin](https://www.cygwin.com/) to run the `readelf` utility)\n 2. Grep usage is optional to filter the text output\n 3. Look for Build ID\n\n readelf -n libil2cpp.so | grep 'Build ID'\n Build ID: b42473fb7449e44e0182dd1f580c99bab0cd8a95\n\nInspect game code\n\nWhen the stack trace shows a function in the `libil2cpp.so` library,\nthe error happened in the C# code, which is [converted to C++](https://docs.unity3d.com/Manual/overview-of-dot-net-in-unity.html).\nThe `libil2cpp.so` library has not only your game code but also plugins and packages.\n\nThe C++ filename follows the assembly name defined in the Unity project.\nOtherwise, the filename has the default Assembly-C# name. For example,\nfigure 3 shows the error on file `Game.cpp` (highlighted in blue), which\nis the name defined in the Assembly Definition file. `Logger` is the\nclass name (highlighted in red) in the C# script, followed by the\nfunction name (highlighted in green). Finally is the full name\nthat the IL2CPP converter generated (highlighted in orange).\n**Figure 3.** Test project call stack from Backtrace.\n\nInspect your game code by doing the following:\n\n- Examine the C# project for any suspicious code. Usually, C# unhandled exceptions don't cause an ANR or application crash. Even so, ensure the code runs properly in different situations. Check whether the code uses a third-party engine module, and analyze whether a recent release introduced the error. In addition, review whether you have recently updated Unity or whether the error only happens on specific devices.\n- [Export](https://docs.unity3d.com/Manual/android-export-process.html) the game as an Android Studio project. With complete access to your game's converted C# source code, you can find the function that's causing the ANR. The C++ code looks very different from your C# code, and the code conversion rarely has an issue. If you do find something, file a support ticket to Unity.\n- Review the game source code and ensure that any logic running in the [OnApplicationFocus()](https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnApplicationFocus.html) and [OnApplicationPause()](https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnApplicationPause.html) callbacks is appropriately cleaned up.\n - The Unity engine has a timeout to pause its execution; excessive workload on these callbacks can cause an ANR.\n - Add logs or breadcrumbs to parts of the code to enhance your data analysis.\n- Use the [Unity Profiler](https://docs.unity3d.com/Manual/Profiler.html) to investigate the game's performance. Profiling your app can also be a great way to help identify bottlenecks that might be causing the ANR.\n- A great way to identify long I/O operations on the main thread is to use [strict mode](/topic/performance/vitals/anr#strict_mode).\n- Analyze the Android Vitals or another reporting service history and check the release versions of the game for which the error is happening the most. Review your source code in your version control history and compare code changes between releases. If you find something suspicious, experiment with each change or potential fix individually.\n- Examine the Google Play ANR reporting history for the devices and Android versions receiving the most ANRs. If the devices or versions are outdated, chances are you can safely ignore them if doing so doesn't impact the game's profitability. Study the data carefully since a particular group of users will no longer be able to play your game. For more information, see [Distribution\n dashboard](/about/dashboards).\n- Review the game source code to ensure you are not calling any code that might cause an issue, for example, [finish](/reference/android/app/Activity#finish()) can be destructive if not used correctly. See the [Android developer guides](/guide) to learn more about Android development.\n- After reviewing the data and exporting the game build to Android Studio, you're dealing with C and C++ code, and so you can take full advantage of tools beyond Unity's standard solutions, such as [Android Memory Profiler](/studio/profile/memory-profiler), [Android CPU Profiler](/studio/profile/cpu-profiler), and [perfetto](/tools/perfetto).\n\n| **Warning:** Avoid custom code loading---both native and managed---with [Play Asset Delivery](/guide/playcore/asset-delivery), as code loading causes hard-to-debug ANRs.\n\nUnity engine code\n\nTo know if an ANR is happening on the Unity engine side of things, check for\n`libUnity.so` or `libMain.so` in the stack traces. If you find them, take the\nfollowing steps:\n\n- First, search the community channels ([Unity Forums](https://forum.unity.com/), [Unity\n Discussions](https://discussions.unity.com/), [Stackoverflow](https://stackoverflow.com/questions/tagged/unity-game-engine?tab=Newest)%7B:.external%7D)).\n- If you do not find anything, [file a bug](https://unity.com/releases/editor/qa/bug-reporting) to resolve the problem. Provide a symbolicated stack trace so the engine's engineers can better understand and solve the error.\n- Check whether the latest [Unity\n LTS](https://unity.com/releases/editor/qa/lts-releases) has made improvements related to your issues. If so, upgrade your game to use that version. (This solution may be possible only for some developers.)\n- If your code uses a custom [`Activity`](/reference/android/app/Activity) instead of the default, review the Java code to ensure the activity is not causing any issues.\n\nThird-party SDK\n\n- Check that all third-party libraries are up to date and don't have reports of crashes or ANRs for the latest version of Android.\n- Go to the [Unity Forums](https://forum.unity.com/) to see if any errors have already been resolved in a later version or if a workaround has been provided by Unity or a community member.\n- Review the [Google Play ANR report](https://support.google.com/googleplay/android-developer/answer/9859174) and ensure the error has not already been identified by Google. Google is aware of some ANRs and is actively working to fix them.\n\n| **Note:** The [Google Play SDK Console](https://play.google.com/sdk-console/about/) allows SDK providers to access usage statistics, crash and ANR (application not responding) reporting, and tools to help guide app developers in adopting SDK versions that fix quality issues and comply with Play policies. You can submit bug reports and feedback to the Google Play SDK Console to help the SDK provider improve their SDK.\n\nSystem library\n\nSystem libraries usually are far from the developer's control, but they don't\nrepresent a significant percentage of ANRs. Beyond contacting the library\ndeveloper or adding logs to narrow down the problem, system library ANRs are\ndifficult to resolve.\n\nExit reasons\n\n[`ApplicationExitInfo`](/reference/android/app/ApplicationExitInfo) is an Android API for understanding ANR causes.\nIf your game is using [Unity 6 or later](https://docs.unity3d.com/6000.0/Documentation/ScriptReference/Android.IApplicationExitInfo.html) you can call `ApplicationExitInfo`\ndirectly. For older Unity versions, you need to implement your own plugin\nto enable `ApplicationExitInfo` calls from Unity.\n\nCrashlytics also uses `ApplicationExitInfo`; however, your own\nimplementation gives you finer control and enables you to include\n[more relevant information](/reference/kotlin/android/app/ActivityManager#setprocessstatesummary)."]]