Version: 2021.1
Android
Unity를 Android 애플리케이션에 통합

Android 환경 설정

Android에서 빌드하고 실행하려면 Unity Android Build Support 플랫폼 모듈을 설치해야 합니다. 또한 Android 기기에서 코드를 빌드하고 실행하기 위해 필요한 Android SDK(Software Development Kit, 소프트웨어 개발 키트)와 NDK(Native Development Kit, 네이티브 개발 키트)를 설치해야 합니다. Unity는 기본적으로 OpenJDK에 기반한 Java Development Kit를 설치합니다.

참고: Unity는 Android 4.4 “KitKat” 이상을 지원합니다. 자세한 내용은 AndroidSdkVersions를 참조하십시오.

Install Android Build Support and the Android SDK & NDK tools

Use the Unity Hub to install Android Build Support and the required dependencies: Android SDK & NDK tools, and OpenJDK.

You can install Android Build Support, the Android SDK & NDK tools, and OpenJDK when you install the Unity Editor, or add them at a later time.

For information on how to add the Android modules:

Enable USB debugging on your device

To enable USB debugging, you must enable Developer options on your device. To do this, see Android’s Configure developer options documentation.

Use a USB cable to connect your device to your computer. If you are developing on a Windows computer, you might need to install a device-specific USB driver. See the manufacturer website for your device for additional information.

The setup process differs for Windows and macOS. For more information on connecting your Android device to the SDK, refer to the Run Your App section of the Android Developer documentation.

Android SDK 및 NDK 툴과 OpenJDK 설치 커스터마이즈

You should use the Unity Hub to install Android SDK & NDK tools, to ensure that you receive the correct versions and configuration. Unity installs Android SDK & NDK Tools and OpenJDK respectively in the SDK, NDK and folders under /Unity/Hub/Editor/[EditorVersion]/Editor/Data/PlaybackEngines/AndroidPlayer/.

If you have multiple versions of Unity with the same required dependencies (check System requirements for the latest) and you want to avoid duplicating the installation of Android SDK & NDK Tools and OpenJDK, you can specify a shared location in the Unity Preferences window. To do this, go to Preferences > External tools and enter the directory paths in the SDK and NDK fields:

Android용 외부 툴 설정이 표시된 환경 설정 창
Android용 외부 툴 설정이 표시된 환경 설정 창

경고: Unity는 직접 제공하는 OpenJDK, SDK 또는 NDK 버전 외 다른 버전을 공식 지원하지 않습니다.

Unity가 Android 앱 빌드에 사용하는 OpenJDK, SDK 툴 또는 NDK를 변경하려면 다음 절차를 따르십시오.

  1. Open your Unity project.

  2. Open the Preferences window (Windows and Linux: Edit > Preferences; macOS: Unity > Preferences).

  3. In the left navigation column, select External Tools.

  4. Change the OpenJDK path:
    1. Disable the JDK Installed with Unity (recommended) setting.
    2. In the JDK field, enter the path to the JDK installation folder, or use the Browse button to locate it.
  5. Change the Android SDK Tools path:
    1. Disable the Android SDK Tools Installed with Unity (recommended) setting.
    2. In the SDK field, enter the path to the SDK installation folder, or use the Browse button to locate it.

    Note: Unity works with the most recent version of the Android SDK available at the time of the Unity version release.

  6. Change the Android NDK path:
    1. Android NDK Installed with Unity (recommended) 를 선택 해제합니다.
    2. In the NDK field, enter the path to the NDK installation folder, or use the Browse button to locate it.

Each version of Unity requires a specific version of the Android NDK:

Unity 버전 NDK 버전
2018.4 LTS r16b
2019.4 LTS r19
2020.3 LTS r19
2021.1 r21d

요구 사항에 대한 전체 리스트는 시스템 요구 사항 페이지를 참조하십시오.

Updating the Android SDK Target API

Unity Hub installs the latest version of the Android SDK Target API required by Google Play.

If you need to use a more recent version, you can change the Target API from the Target API Level field in the Player Settings window (menu: Edit > Project Settings > Player, then select the Android platform). You can find the Target API Level option in the Other Settings > Identification section.

Selecting a target API for the Android SDK
Selecting a target API for the Android SDK

After you select an option other than the default, Unity prompts you to update the Android SDK API. You can choose to either:

  • Update the Android SDK
  • Continue to use the highest installed version of the Android SDK

If you select an older version of the Target API, the Unity Android SDK Updater won’t be able to perform the update and gives an error message.

In this case, to update the Android SDK Target API, you must use the Android sdkmanager from either Android Studio or the command line tool. Regardless of the method you choose, make sure to select the correct Android SDK folder for Unity in the Edit > Preferences > External Tools window.

Important: On Windows, if you installed the Unity Editor in the default folder (/Program Files/), you must run the sdkmanager with elevated privilege (Run as Administrator) to perform the update.

Android
Unity를 Android 애플리케이션에 통합