android_gradle_build.rst 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. .. _doc_android_gradle_build:
  2. Gradle builds for Android
  3. =========================
  4. Godot provides the option to build using the gradle buildsystem. Instead of
  5. using the already pre-built template that ships with Godot, an Android
  6. Java project gets installed into your project folder. Godot will then build it
  7. and use it as an export template every time you export the project.
  8. There are some reasons why you may want to do this:
  9. * Modify the project before it's built.
  10. * Add external SDKs that build with your project.
  11. Configuring the gradle build is a fairly straightforward process. But first
  12. you need to follow the steps in :ref:`exporting for android<doc_exporting_for_android>`
  13. up to **Setting it up in Godot**. After doing that, follow the steps below.
  14. Set up the gradle build environment
  15. -----------------------------------
  16. Go to the Project menu, and install the *Gradle Build* template:
  17. .. image:: img/gradle_build_install_template.webp
  18. Make sure export templates are downloaded. If not, this menu will help you
  19. download them.
  20. A Gradle-based Android project will be created under ``res://android/build``.
  21. Editing these files is not needed unless you really need to modify the project.
  22. Enabling the gradle build and exporting
  23. ---------------------------------------
  24. When setting up the Android project in the **Project > Export** dialog,
  25. **Gradle Build** needs to be enabled:
  26. .. image:: img/gradle_build_enable.webp
  27. From now on, attempting to export the project or one-click deploy will call the
  28. `Gradle <https://gradle.org/>`__ build system to generate fresh templates (this
  29. window will appear every time):
  30. .. image:: img/gradle_build_gradle.webp
  31. The templates built will be used automatically afterwards, so no further
  32. configuration is needed.
  33. .. note::
  34. When using the gradle Android build system, assets that are placed within a
  35. folder whose name begins with an underscore will not be included in the
  36. generated APK. This does not apply to assets whose *file* name begins with
  37. an underscore.
  38. For example, ``_example/image.png`` will **not** be included as an asset,
  39. but ``_image.png`` will.