Android 네이티브 개발 키트(NDK): Android에서 C 및 C++ 코드를 사용할 수 있도록 해주는 도구 모음입니다.
CMake: Gradle과 함께 작동하여 네이티브 라이브러리를 빌드하는 외부 빌드 도구입니다. ndk-build만 사용하려는 경우에는 이 구성요소가 필요하지 않습니다.
LLDB: Android 스튜디오에서 네이티브 코드를 디버깅하는 데 사용하는 디버거입니다. 기본적으로 LLDB는 Android 스튜디오와 함께 설치됩니다.
이 페이지에서는 이러한 구성요소를 자동으로 설치하거나, Android 스튜디오 또는 sdkmanager 도구를 사용하여 구성요소를 수동으로 다운로드하고 설치하는 방법을 설명합니다.
NDK 및 CMake 자동 설치
Android Gradle 플러그인 4.2.0 이상에서는 라이선스가 사전에 수락된 경우 프로젝트를 처음 빌드할 때 필수 NDK 및 CMake를 자동으로 설치할 수 있습니다.
라이선스 약관을 이미 읽고 이에 동의했다면 스크립트에서 다음 명령어를 사용하여 사전에 라이선스를 수락할 수 있습니다.
개발자가 NDK를 설치하면 Android 스튜디오에서 사용 가능한 최신 NDK가 선택됩니다. 대부분의 프로젝트는 기본 NDK 버전이면 충분합니다.
하지만 프로젝트에 특정 NDK 버전이 하나 이상 필요한 경우 특정 버전을 다운로드하고 설정할 수 있습니다. 이렇게 하면 여러 프로젝트에서 각각 특정 NDK 버전에 종속된 재현 가능한 빌드를 만들 수 있습니다. Android 스튜디오는 모든 NDK 버전을 android-sdk/ndk/ 디렉터리에 설치합니다.
Android 스튜디오에서 CMake와 기본 NDK를 설치하려면 다음을 따르세요.
프로젝트를 연 상태에서 Tools > SDK Manager를 클릭합니다.
SDK Tools 탭을 클릭합니다.
NDK (Side by side) 및 CMake 체크박스를 선택합니다.
그림 1.NDK(Side by side) 옵션을 보여주는 SDK 도구 창
OK를 클릭합니다.
대화상자에 NDK 패키지가 디스크에서 차지하는 공간이 표시됩니다.
OK를 클릭합니다.
설치가 완료되면 Finish를 클릭합니다.
프로젝트가 자동으로 빌드 파일을 동기화하고 빌드를 실행합니다.
발생하는 모든 오류를 해결하세요.
특정 버전의 CMake 설정
SDK Manager에는 CMake의 포크된 3.6.0 버전과 3.10.2 버전이 포함됩니다. 특정 CMake 버전을 설정하지 않은 프로젝트는 CMake 3.10.2로 빌드됩니다. CMake 버전을 설정하려면 다음을 모듈의 build.gradle 파일에 추가하세요.
출시 전에 각 AGP 버전은 해당 시점에 안정적인 것으로 평가된 최신 NDK 버전으로 철저하게 테스트됩니다. build.gradle 파일에 NDK 버전을 지정하지 않으면 이 NDK 버전이 프로젝트를 빌드하는 데 사용됩니다. 다양한 AGP 버전의 기본 NDK 버전은 AGP 출시 노트 및 AGP 이전 출시 노트에 문서화되어 있습니다.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-08-21(UTC)
[null,null,["최종 업데이트: 2025-08-21(UTC)"],[],[],null,["# Install and configure the NDK and CMake\n\nTo compile and debug native code for your app, you need the following components:\n\n- The Android Native Development Kit (NDK): a set of tools that allows you to use C and C++ code with Android.\n- CMake: an external build tool that works alongside Gradle to build your native library. You do not need this component if you only plan to use ndk-build.\n- LLDB: the debugger Android Studio uses to debug native code. By default, LLDB will be installed alongside Android Studio.\n\nThis page describes how to install these components automatically, or by using\nAndroid Studio or the `sdkmanager` tool to download and install them manually.\n\nInstall NDK and CMake automatically\n-----------------------------------\n\nAndroid Gradle Plugin 4.2.0+ can automatically install the required NDK and CMake\nthe first time you build your project if their licenses have been accepted in advance.\nIf you've already read and agree to the license terms, then you can pre-accept\nthe licenses in scripts with the following command: \n\n yes | ${sdk}/cmdline-tools/latest/bin/sdkmanager --licenses\n\nInstall the NDK and CMake\n-------------------------\n\nWhen you install the NDK, Android Studio selects the latest available NDK. For\nmost projects, installing this default version of the NDK is sufficient.\nIf your project needs one or more specific versions of the NDK, though, you can\n[download and configure specific versions](#specific-version). Doing so helps\nyou ensure reproducible builds across projects that each depend on a specific\nversion of the NDK. Android Studio installs all versions of the NDK in the\n\u003cvar translate=\"no\"\u003eandroid-sdk\u003c/var\u003e`/ndk/` directory.\n\nTo install CMake and the default NDK in Android Studio, do the following:\n\n1. With a project open, click **Tools \\\u003e SDK Manager**.\n\n2. Click the **SDK Tools** tab.\n\n3. Select the **NDK (Side by side)** and **CMake** checkboxes.\n\n\n **Figure 1.** The **SDK Tools** window showing the **NDK (Side by side)**\n option\n | **Note:** If you have an NDK installed in the `ndk-bundle` folder, it appears in the list with the label **NDK** . If you are using Android Gradle plugin 3.5.0 or later, you can select this checkbox or clear it. Clearing the checkbox uninstalls the NDK, freeing up disk space, and causes the checkbox to disappear from the list. If you uninstall the legacy NDK, remove the `ndk.dir` value, which is now deprecated, from your projects' `local.properties` files.\n4. Click **OK**.\n\n A dialog box tells you how much space the NDK package consumes on disk.\n5. Click **OK**.\n\n6. When the installation is complete, click **Finish**.\n\n7. Your project automatically syncs the build file and performs a build.\n Resolve any errors that occur.\n\n### Configure a specific version of CMake\n\nThe SDK Manager includes the 3.6.0 forked version of\nCMake and version 3.10.2. Projects that don't set a\nspecific CMake version are built with CMake 3.10.2. To\nset the CMake version, add the following to your module's `build.gradle` file: \n\n### Groovy\n\n```groovy\nandroid {\n ...\n externalNativeBuild {\n cmake {\n ...\n version \"\u003cvar translate=\"no\"\u003ecmake-version\u003c/var\u003e\"\n }\n }\n}\n```\n\n### Kotlin\n\n```kotlin\nandroid {\n ...\n externalNativeBuild {\n cmake {\n ...\n version = \"\u003cvar translate=\"no\"\u003ecmake-version\u003c/var\u003e\"\n }\n }\n}\n```\n\nIf you want to use a CMake version that is not included by the\nSDK Manager, follow these steps:\n\n1. Download and install [CMake](https://cmake.org/download/) from the official CMake website.\n2. Specify the CMake version you want Gradle to use in your module's `build.gradle` file.\n3. Either add the path to the CMake installation to your `PATH` environment\n variable or include it in your project's `local.properties` file, as\n shown. If Gradle is unable to find the version of CMake you specified in\n your `build.gradle` file, you get a build error.\n\n # If you set this property, Gradle no longer uses PATH to find CMake.\n cmake.dir = \"\u003cvar translate=\"no\"\u003epath-to-cmake\u003c/var\u003e\"\u003c/pre\u003e\n\n4. If you don't already have the Ninja build system installed on your\n workstation, go to the [official Ninja website](https://ninja-build.org/),\n and download and install the latest version of Ninja available for your OS.\n Make sure to also add the path to the Ninja installation to your\n `PATH` environment variable.\n\nInstall a specific version of the NDK\n-------------------------------------\n\nTo install a specific version of the NDK, do the following:\n\n1. With a project open, click **Tools \\\u003e SDK Manager**.\n\n2. Click the **SDK Tools** tab.\n\n3. Select the **Show Package Details** checkbox.\n\n4. Select the **NDK (Side by side)** checkbox and the checkboxes below it that\n correspond to the NDK versions you want to install. Android Studio installs\n all versions of the NDK in the \u003cvar translate=\"no\"\u003eandroid-sdk\u003c/var\u003e`/ndk/`\n directory.\n\n | **Note:** Preview releases (for example, canary and beta) of the NDK do not show up in this list unless you [change the update channel](/studio/preview/install-preview#change_your_update_channel) for Android Studio. You can [install an Android Studio preview](/studio/preview/install-preview) side-by-side with the stable version.\n\n\n **Figure 2.** The **SDK Tools** window showing the **NDK (Side by side)**\n options\n | **Note:** If you have an NDK installed in the `ndk-bundle` folder, it appears in the list with the label **NDK** . If you are using Gradle version 3.5 or later, you can select this checkbox or clear it. Clearing it uninstalls the NDK installed, freeing up disk space, and cause the checkbox to disappear from the list. If you uninstall the legacy NDK, remove the `ndk.dir` value, which is now deprecated, from your projects' `local.properties` files.\n5. Click **OK**.\n\n A dialog box tells you how much space the NDK package(s) consumes.\n6. Click **OK**.\n\n7. When the installation is complete, click **Finish**.\n\n8. Your project automatically syncs the build file and performs a build.\n Resolve any errors that occur.\n\n9. [Configure each module](#apply-specific-version) with the version of the NDK\n you want it to use. When using Android Studio 3.6 or higher, if you do not\n specify the version, the Android Gradle plugin chooses a version that it is\n known to be compatible with.\n\nConfigure specific versions of the NDK in your project\n------------------------------------------------------\n\nYou may need to configure the version of the NDK in your project if one of the\nfollowing is true:\n\n- Your project is inherited and you need to use specific versions of the NDK and the Android Gradle plugin (AGP). For more information, see [Configure the NDK for the Android Gradle plugin](/studio/projects/configure-agp-ndk).\n- You have multiple versions of the NDK installed and you want to use a specific\n one. In this case, specify the version using the `android.ndkVersion`\n property in the module's `build.gradle` file, as shown in the following code\n sample.\n\n ### Groovy\n\n ```groovy\n android {\n ndkVersion \"\u003cvar translate=\"no\"\u003emajor\u003c/var\u003e.\u003cvar translate=\"no\"\u003eminor\u003c/var\u003e.\u003cvar translate=\"no\"\u003ebuild\u003c/var\u003e\" // e.g., ndkVersion \"21.3.6528147\"\n }\n ```\n\n ### Kotlin\n\n ```kotlin\n android {\n ndkVersion = \"\u003cvar translate=\"no\"\u003emajor\u003c/var\u003e.\u003cvar translate=\"no\"\u003eminor\u003c/var\u003e.\u003cvar translate=\"no\"\u003ebuild\u003c/var\u003e\" // e.g., ndkVersion \"21.3.6528147\"\n }\n ```\n\n### Default NDK version per AGP version\n\nBefore release, each AGP version is thoroughly tested with the latest stable NDK\nrelease at that time. This NDK version is used to build your projects if you\ndon't specify an NDK version in the `build.gradle` file. The default NDK version\nfor different versions of AGP are documented in the\n[AGP release notes](/build/releases/gradle-plugin#compatibility) and\n[AGP past release notes](/build/releases/past-releases)."]]