resolving_crashes_on_android.rst 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. .. _doc_resolving_crashes_on_android:
  2. Resolving crashes on Android
  3. ============================
  4. When your game crashes on Android, you often see obfuscated stack traces in Play Console
  5. or other crash reporting tools like Firebase Crashlytics. To make these stack traces human-readable (symbolicated),
  6. you need native debug symbols that correspond to your game's exported build.
  7. Godot now provides downloadable native debug symbols for each official export template.
  8. Getting Native Debug symbols for official templates
  9. ---------------------------------------------------
  10. Native debug symbol files are provided for every stable Godot release
  11. and can be downloaded from the `GitHub release page <https://github.com/godotengine/godot/releases/>`_.
  12. For example, to get the native debug symbols for version ``4.5.1.stable``:
  13. - Go to the `4.5.1.stable release page <https://github.com/godotengine/godot/releases/>`_
  14. - Download the release artifact ``Godot_native_debug_symbols.4.5.1.stable.template_release.android.zip``
  15. Getting Native Debug symbols for custom builds
  16. ----------------------------------------------
  17. Your exported template and its native debug symbols must come from the **same build**,
  18. so you can use the official symbols only if you are using the **official export templates**.
  19. If you are building **custom export templates**, you need to generate matching symbol files yourself.
  20. To do so, add ``debug_symbols=yes separate_debug_symbols=yes`` to your scons build command.
  21. This will generate a file named ``android-template-release-native-symbols.zip`` containing the native debug symbols for your custom build.
  22. For example,
  23. ::
  24. scons platform=android target=template_release debug_symbols=yes separate_debug_symbols=yes generate_android_binaries=yes
  25. If you are building for multiple architectures, you should include the ``separate_debug_symbols=yes`` only in the last build command,
  26. similar to how ``generate_android_binaries=yes`` is used.
  27. ::
  28. scons platform=android arch=arm32 target=template_release debug_symbols=yes
  29. scons platform=android arch=arm64 target=template_release debug_symbols=yes
  30. scons platform=android arch=x86_32 target=template_release debug_symbols=yes
  31. scons platform=android arch=x86_64 target=template_release debug_symbols=yes separate_debug_symbols=yes generate_android_binaries=yes
  32. Uploading Symbols to Google Play Console
  33. ----------------------------------------
  34. Follow these steps to upload the native debug symbols:
  35. 1. Open `Play Console <https://play.google.com/console>`_.
  36. 2. Select any app.
  37. 3. In the left menu, navigate to ``Test and release > Latest releases and bundles``.
  38. .. image:: img/play_console_latest_release_bundles.webp
  39. 4. Now choose the relevant bundle and open it.
  40. .. image:: img/play_console_latest_release_bundles2.webp
  41. 5. Select the ``Downloads`` tab, and scroll down to the ``Assets`` section.
  42. .. image:: img/play_console_app_bundle_explorer.webp
  43. 6. Next to ``Native debug symbols``, click the upload arrow icon.
  44. .. image:: img/play_console_app_bundle_explorer2.webp
  45. 7. Select and upload the corresponding native debug symbols file for that build version.
  46. .. image:: img/play_console_upload_native_debug_symbols.webp
  47. Alternatively, you can upload the symbols when creating a new release:
  48. 1. On the Create release page, locate your new release bundle.
  49. .. image:: img/play_console_create_new_release.webp
  50. 2. Click the three-dot menu beside it.
  51. 3. Choose ``Upload native debug symbols (.zip)`` from the menu.
  52. .. image:: img/play_console_create_new_release2.webp
  53. 4. Select and upload the corresponding native debug symbols file for that build version.
  54. Manually Symbolicating Crash Logs
  55. ---------------------------------
  56. You can also symbolicate the crash logs manually using the `ndk-stack <https://developer.android.com/ndk/guides/ndk-stack>`_ tool included in the Android NDK.
  57. .. note::
  58. If you already have the Android SDK installed, you can find the ``ndk-stack`` tool inside the ``ndk`` folder in your SDK location.
  59. Otherwise, you can download the NDK directly from the `NDK downloads page <https://developer.android.com/ndk/downloads>`_.
  60. 1. Extract the native debug symbols zip you downloaded earlier (or generated with your custom build).
  61. 2. Save your crash log to a text file (for example, ``crash.txt``).
  62. 3. Run ndk-stack with the path to the symbol directory that matches the crash's CPU architecture (for example, ``arm64-v8a``):
  63. ::
  64. ndk-stack -sym path/to/native_debug_symbols/arm64-v8a/ -dump crash.txt
  65. 4. The output will display a symbolicated trace, showing file names and line numbers in Godot's source code (or your custom build).