Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

Android로 내보내기

더 보기

This page describes how to export a Godot project to Android. If you're looking to compile export template binaries from source instead, read Compiling for Android.

Android로 내보내는 작업은 Android용으로 Godot를 컴파일하는 것보다 간단합니다. 다음은 Android SDK와 엔진 설정에 필요한 작업들입니다.

주의

Projects written in C# can be exported to Android as of Godot 4.2, but support is experimental and some limitations apply.

Install OpenJDK 17

Download and install OpenJDK 17.

Android SDK 다운로드하기

Download and install the Android SDK.

  • You can install the Android SDK using Android Studio version 4.1 or later.

    • 실행한 뒤 설명 을 참고해 SDK 설정을 마치십시오.

    • 필요한 패키지 가 모두 설치되었는지도 확인하십시오.

      • Android SDK Platform-Tools 30.0.5 버전 또는 이상

      • Android SDK Build-Tools version 33.0.2

      • Android SDK Platform 33

      • 최신 버전의 Android SDK Command-line Tools

      • CMake 3.10.2.4988404 버전

      • NDK version r23c (23.2.8568313)

  • Alternatively, you can install the Android SDK using the command line tools.

    • 커맨드 라인 툴이 설치되면 아래의 sdkmanager 명령을 실행해 설정을 완료하십시오:

sdkmanager --sdk_root=<android_sdk_path> "platform-tools" "build-tools;33.0.2" "platforms;android-33" "cmdline-tools;latest" "cmake;3.10.2.4988404" "ndk;23.2.8568313"

참고

Linux를 사용중이라면 사용중인 Linux 배포판 저장소의 Android SDK는 너무 오래됐을 확률이 높으므로 사용하지 마십시오.

debug.keystore 만들기

Android에 non-release APK를 배포 및 기기에 설치하려면 디버그용 keystore 파일이 필요합니다. 이전에 SDK를 사용해 프로젝트를 만든 적이 있다면 ant나 eclipse가 생성한 파일이 남아있을 것입니다(Linux와 macOS는 ~/.android 디렉토리, Windows는 C:\Users\<user>\.android\ 디렉토리를 확인하십시오).

찾을 수 없거나 만들어야 하는 경우 JDK에서 다음과 같이 keytool 명령어를 사용할 수 있습니다:

keytool -keyalg RSA -genkeypair -alias androiddebugkey -keypass android -keystore debug.keystore -storepass android -dname "CN=Android Debug,O=Android,C=US" -validity 9999 -deststoretype pkcs12

This will create a debug.keystore file in your current directory. You should move it to a memorable location such as %USERPROFILE%\.android\, because you will need its location in a later step. For more information on keytool usage, see this Q&A article.

참고

It is important that the password is the same for the keystore and the key. This is a known Android studio issue that also affects Godot projects.

Godot에서 설정하기

Enter the Editor Settings screen. This screen contains the editor settings for the user account in the computer (it's independent of the project).

../../_images/editorsettings.png

Android 설정이 있는 섹션까지 내립니다:

../../_images/androidsdk.png

이 화면에서 2개의 파일 경로가 설정되어야 합니다:

  • Android Sdk Path 는 Windows의 경우 %LOCALAPPDATA%\Android\Sdk\, macOS의 경우 /Users/$USER/Library/Android/sdk/ 와 같이 Android SDK가 설치된 경로여야 합니다.

  • 디버그용 .keystore 파일의 경우 이전에 debug.keystore 를 저장했던 경로를 사용하십시오.

일단 구성되면, Android에 내보낼 준비가 끝납니다!

참고

만약 "Could not install to device." 라는 에러가 발생한다면 동일한 Android 패키지 이름을 가진 (하지만 다른 키로 서명된) 애플리케이션이 장치에 설치되어 있는지 확인하십시오.

장치에 다른 키로 서명된 같은 Android package 이름의 애플리케이션이 이미 존재한다면 Android로 다시 내보내기 전에 반드시 그 어플리케이션을 기기에서 제거해야 합니다.

런처 아이콘 만들기

런처 아이콘은 Android 앱에서 사용자에게 애플리케이션을 나타내는 데 사용됩니다. Godot은 고해상도 아이콘 (xxxhdpi) 만 필요하며 저해상도는 자동으로 생성합니다.

Godot에서 요구하는 아이콘 종류는 두 가지가 있습니다:

  • Main Icon: 기존의 아이콘입니다. Android 8 (Oreo) 미만의 모든 Android 버전에서 사용됩니다. 192 × 192 픽셀 이상이어야 합니다.

  • ** Adaptive Icons : ** Android 8 (포함)부터 Adaptive Icons 가 도입되었습니다. 앱은 배경 및 전경 아이콘을 포함해야합니다. 사용자의 런처 응용 프로그램은 아이콘의 애니메이션 및 마스킹을 제어합니다. 432 × 432 픽셀 이상이어야합니다.

더 보기

적응형 아이콘을 디자인 할 때는 몇 가지 준수해야 할 사항이 있습니다. Google Design 의 글 에 적응형 아이콘에 관한 규칙과 기능이 설명되어 있습니다.

조심

적응형 아이콘 디자인에서 가장 중요한 규칙은 아이콘의 중요 요소들이 잘리지 않도록 66dp (xxxhdpi 에서 264 픽셀) 반경의 원 안에 배치하는 것입니다.

만약 아이콘을 전부 추가하지 않았다면 Godot은 추가되지 않은 아이콘을 fallback chain을 사용해 다음의 순서로 대체를 시도합니다:

  • Main Icon: 추가된 메인 아이콘 -> 프로젝트 아이콘 -> Godot 기본 메인 아이콘.

  • Adaptive Icon Foreground: 추가한 전경 아이콘 -> 프로젝트 아이콘 -> Godot 기본 전경 아이콘.

  • Adaptive Icon Background: 추가한 배경 아이콘 -> Godot 기본 배경 아이콘.

애플리케이션 아이콘이 모든 Android 기기에서 잘 표시될 수 있도록 모든 아이콘을 해상도에 맞게 추가하는 것을 권장합니다.

구글 플레이 스토어로 내보내기

APK를 구글 플레이 스토어에 업로드 하려면 비 디버그 키스토어 파일을 서명해야합니다; 그러한 파일은 다음과 같이 생성될 수 있습니다:

keytool -v -genkey -keystore mygame.keystore -alias mygame -keyalg RSA -validity 10000

이 키스토어와 키는 개발자 ID를 확인하는데 사용됩니다, 암호를 기억하고 안전한 장소에 보관하세요! APK 서명에 대해 더 자세히 배우고 싶다면 구글 Android 개발자 가이드를 사용하세요.

이제 Android 내보내기 프리셋에서 다음 항목을 채우세요:

../../_images/editor-export-presets-android.png
  • Release: Enter the path to the keystore file you just generated.

  • Release User: Replace with the key alias.

  • Release Password: Key password. Note that the keystore password and the key password currently have to be the same.

Don't forget to uncheck the Export With Debug checkbox while exporting.

../../_images/export-with-debug-button.png

APK 용량 최적화하기

APK가 기본값처럼 ARMv7과 ARMv8 아키텍처의 네이티브 라이브러리 모두를 포함하고 있으면 용량이 상당히 많이 늘어나게 됩니다. 프로젝트의 Android 프리셋에서 Armeabi-v 7a 또는 Arm 64 -v 8a 에 체크를 해제해 한 아키텍처의 라이브러리만 포함하게 하면 APK 용량을 줄일 수 있습니다. ARMv7 어플리케이션은 ARMv8에서도 실행이 가능하지만 그 반대는 불가능 하다는 사실을 유념하십시오.

2019년 8월 이후부터 Google Play는 모든 애플리케이션이 64-bit를 지원할 것을 요구합니다. 따라서 ARMv7 라이브러리를 포함한 APK 딱 하나만을 업로드 할 수는 없습니다. 따라서 Google Play의 `다중 APK 지원<https://developer.android.com/google/play/publishing/multiple-apks>`__ 기능을 사용해 서로 다른 단일 아키텍처용 APK 여러 개를 업로드 해야 합니다. ARMv7과 ARMv8용 APK만으로도 현재 사용되는 거의 모든 기기를 지원하기에 충분합니다.

그 밖에서 Android 내보내기 템플릿의 필요한 기능만을 활성화 해 컴파일하는 등으로 용량을 더 줄일 수 있습니다. :ref:`doc_optimizing_for_size`에서 추가 정보를 확인하십시오.

Environment variables

You can use the following environment variables to set export options outside of the editor. During the export process, these override the values that you set in the export menu.

Android export environment variables

Export option

Environment variable

Encryption / Encryption Key

GODOT_SCRIPT_ENCRYPTION_KEY

Options / Keystore / Debug

GODOT_ANDROID_KEYSTORE_DEBUG_PATH

Options / Keystore / Debug User

GODOT_ANDROID_KEYSTORE_DEBUG_USER

Options / Keystore / Debug Password

GODOT_ANDROID_KEYSTORE_DEBUG_PASSWORD

Options / Keystore / Release

GODOT_ANDROID_KEYSTORE_RELEASE_PATH

Options / Keystore / Release User

GODOT_ANDROID_KEYSTORE_RELEASE_USER

Options / Keystore / Release Password

GODOT_ANDROID_KEYSTORE_RELEASE_PASSWORD