Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

Android 용 맞춤 빌드

Godot provides the option to build using the Gradle build system. Instead of using the already pre-built template that ships with Godot, an Android Java project gets installed into your project folder. Godot will then build it and use it as an export template every time you export the project.

이렇게 하고 싶어하는 몇 가지 이유가 있습니다:

  • Export an AAB file for Google Play.

  • 빌드하기 전 프로젝트를 수정하기

  • 프로젝트가 있는 빌드에 외부 SDK를 추가하기

The native portion of the template (the .so library included in the APK) remains precompiled. This means that unlike compiling a custom Android export template, you don't need to install a C++ toolchain or clone the Godot source code.

Configuring the Gradle build is a fairly straightforward process. But first, you need to follow the steps in exporting for android up to Setting it up in Godot. After doing that, follow the steps below.

Set up the Gradle build environment

프로젝트 메뉴로 이동하고 Gradle 빌드 템플릿을 설치합니다:

../../_images/gradle_build_install_template.webp

내보내기 템플릿을 다운로드했어야 합니다. 그렇지 않았더라도 이 메뉴가 도움을 줄 것입니다.

Gradle 기반 Android 프로젝트가 res://android/build 에 생성될 겁니다. :ref:`애드온을 제작<doc_android_plugin>`하거나 프로젝트를 변경할 생각이 아니라면 이 파일은 건드릴 필요가 없습니다.

Performing Gradle builds from the Android editor

Since Godot 4.6, it is possible to perform Gradle builds from the Android editor. This requires installing the Godot Android Build Environment (GABE) application on the same device the editor is running on.

참고

This application is not required when exporting from the Android editor with pre-built APK templates, or when exporting to other platforms.

This application lets you install everything required to build Android projects with Gradle. It is called by the editor to perform Gradle builds when exporting to Android.

To set up the build environment, open the app and follow these instructions:

  • Ensure you have an active Internet connection.

  • Open the Rootfs tab from the bottom navigation bar.

  • Click Install Rootfs.

After the installation completes, you can export projects using Gradle builds from the Godot editor.

Enabling the Gradle build and exporting

프로젝트 > 내보내기 대화 상자에서 Android 프로젝트를 설정할 때 Gradle 빌드가 활성화되어야 합니다:

../../_images/gradle_build_enable.webp

From now on, attempting to export the project or one-click deploy will call the Gradle build system to generate fresh templates. The templates built will be used automatically afterwards, so no further configuration is needed.

참고

When using the Gradle Android build system, assets that are placed within a folder whose name begins with an underscore will not be included in the generated APK. This does not apply to assets whose file name begins with an underscore.

예를 들어, _example/image.png는 애셋으로 포함되지 않지만 _image.png는 애셋으로 포함됩니다.