종속 항목이 로컬 라이브러리나 파일 트리가 아닌 경우 Gradle은 settings.gradle 파일의 dependencyResolutionManagement { repositories {...} } 블록에서 지정된 온라인 저장소에서 파일을 찾습니다. 각 저장소를 나열하는 순서에 따라 Gradle이 각 프로젝트 종속 항목의 저장소를 검색하는 순서가 결정됩니다.
예를 들어 종속 항목을 저장소 A와 B에서 다운로드할 수 있고 A를 먼저 나열한 경우 Gradle은 저장소 A에서 종속 항목을 다운로드합니다.
기본적으로 새 Android 스튜디오 프로젝트에서 아래와 같이 Google Maven 저장소를 지정하고 Maven 중앙 저장소를 프로젝트의 settings.gradle 파일의 저장소 위치로 지정합니다.
이러한 라이브러리 중 하나를 빌드에 추가하려면 최상위 수준 build.gradle.kts 파일에 Google Maven 저장소를 포함하세요.
Kotlin
dependencyResolutionManagement{repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)repositories{google()// If you're using a version of Gradle lower than 4.1, you must instead use:// maven {// url = "https://maven.google.com"// }// An alternative URL is "https://dl.google.com/dl/android/maven2/".}}
Groovy
dependencyResolutionManagement{repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)repositories{google()// If you're using a version of Gradle lower than 4.1, you must instead use:// maven {// url 'https://maven.google.com'// }// An alternative URL is 'https://dl.google.com/dl/android/maven2/'.}}
그런 다음 원하는 라이브러리를 모듈의 dependencies 블록에 추가합니다.
예를 들어 appcompat 라이브러리는 다음과 같습니다.
Google Maven 저장소에 없는 라이브러리(주로 이전 버전의 라이브러리)의 경우 SDK Manager에서 오프라인 Google 저장소 패키지를 다운로드해야 합니다.
그런 다음 평소와 같이 이러한 라이브러리를 dependencies 블록에 추가할 수 있습니다.
오프라인 라이브러리는 android_sdk/extras/에 저장됩니다.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-08-21(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-08-21(UTC)"],[],[],null,["When your dependency is something other than a local library or file tree,\nGradle looks for the files in whichever online repositories are specified in the\n`dependencyResolutionManagement { repositories {...} }` block of your\n`settings.gradle` file. The order in which you list each repository determines\nthe order in which Gradle searches the repositories for each project dependency.\nFor example, if a dependency is available from both repository A and B, and you\nlist A first, Gradle downloads the dependency from repository A.\n\nBy default, new Android Studio projects specify [Google's Maven repository](#google-maven), and the\n[Maven central repository](https://search.maven.org/) as\nrepository locations in the project's `settings.gradle` file, as shown below: \n\nKotlin \n\n```kotlin\ndependencyResolutionManagement {\n repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)\n repositories {\n google()\n mavenCentral()\n }\n}\n```\n\nGroovy \n\n```groovy\ndependencyResolutionManagement {\n repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)\n repositories {\n google()\n mavenCentral()\n }\n}\n```\n| **Warning:** The JCenter repository, which was included by default in the past, became read-only on March 31st, 2021. For more information, see [JCenter service\n| update](/studio/build/jcenter-migration).\n\nIf you want something from a local repository use `mavenLocal()`: \n\nKotlin \n\n```kotlin\ndependencyResolutionManagement {\n repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)\n repositories {\n google()\n mavenCentral()\n mavenLocal()\n }\n}\n```\n\nGroovy \n\n```groovy\ndependencyResolutionManagement {\n repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)\n repositories {\n google()\n mavenCentral()\n mavenLocal()\n }\n}\n```\n\nOr you can declare specific Maven or Ivy repositories as follows: \n\nKotlin \n\n```kotlin\ndependencyResolutionManagement {\n repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)\n repositories {\n maven(url = \"https://repo.example.com/maven2\")\n maven(url = \"file://local/repo/\")\n ivy(url = \"https://repo.example.com/ivy\")\n }\n}\n```\n\nGroovy \n\n```groovy\ndependencyResolutionManagement {\n repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)\n repositories {\n maven {\n url 'https://repo.example.com/maven2'\n }\n maven {\n url 'file://local/repo/'\n }\n ivy {\n url 'https://repo.example.com/ivy'\n }\n }\n}\n```\n\nFor more information, see the\n[Gradle Repositories guide](https://docs.gradle.org/current/userguide/dependency_management.html#sec:repositories).\n\nGoogle's Maven repository\n\nThe most recent versions of the following Android libraries are available from\nGoogle's Maven repository:\n\n- [AndroidX Libraries](/jetpack/androidx)\n- [Architecture Components Library](/topic/libraries/architecture)\n- [Constraint Layout Library](/training/constraint-layout)\n- [AndroidX Test](/training/testing)\n- [Databinding Library](/topic/libraries/data-binding)\n- [Android Instant App Library](/topic/instant-apps)\n- [Wear OS](/training/building-wearables)\n- [Google Play services](https://developers.google.com/android/guides/setup)\n- [Google Play Billing Library](/google/play/billing)\n- [Firebase](https://firebase.google.com/docs/android/setup)\n\nYou can see all available artifacts at\n[Google's Maven repository index](https://maven.google.com)\n(see below for [programmatic access](#gmaven-access)).\n\nTo add one of these libraries to your build, include Google's Maven repository\nin your top-level `build.gradle.kts` file: \n\nKotlin \n\n```kotlin\ndependencyResolutionManagement {\n\n repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)\n repositories {\n google()\n\n // If you're using a version of Gradle lower than 4.1, you must instead use:\n // maven {\n // url = \"https://maven.google.com\"\n // }\n // An alternative URL is \"https://dl.google.com/dl/android/maven2/\".\n }\n}\n```\n\nGroovy \n\n```groovy\ndependencyResolutionManagement {\n\n repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)\n repositories {\n google()\n\n // If you're using a version of Gradle lower than 4.1, you must instead use:\n // maven {\n // url 'https://maven.google.com'\n // }\n // An alternative URL is 'https://dl.google.com/dl/android/maven2/'.\n }\n}\n```\n\nThen add the desired library to your module's `dependencies` block.\nFor example,the [appcompat library](/jetpack/androidx/releases/appcompat)\nlooks like this: \n\nKotlin \n\n```kotlin\ndependencies {\n implementation(\"com.android.support:appcompat-v7:28.0.0\")\n}\n```\n\nGroovy \n\n```groovy\ndependencies {\n implementation 'androidx.appcompat:appcompat:1.7.0'\n}\n```\n\nHowever, if you're trying to use an older version of the above\nlibraries and your dependency fails, then it's not available in the Maven\nrepository and you must instead get the library from the offline repository.\n\nProgrammatic access\n\nFor programmatic access to Google's Maven artifacts, you can get\nan XML list of artifact groups from [maven.google.com/master-index.xml](https://maven.google.com/master-index.xml).\nThen, for any group, you can view its library names and versions at:\n\n*maven.google.com/\u003cvar translate=\"no\"\u003egroup_path\u003c/var\u003e/group-index.xml*\n\nFor example, libraries in the android.arch.lifecycle group are listed at\n[maven.google.com/android/arch/lifecycle/group-index.xml](https://maven.google.com/android/arch/lifecycle/group-index.xml).\n\nYou can also download the POM and JAR files at:\n\n*maven.google.com/\u003cvar translate=\"no\"\u003egroup_path\u003c/var\u003e/\u003cvar translate=\"no\"\u003elibrary\u003c/var\u003e/\u003cvar translate=\"no\"\u003eversion\u003c/var\u003e\n/\u003cvar translate=\"no\"\u003elibrary\u003c/var\u003e-\u003cvar translate=\"no\"\u003eversion\u003c/var\u003e.\u003cvar translate=\"no\"\u003eext\u003c/var\u003e*\n\nFor example: [maven.google.com/android/arch/lifecycle/compiler/1.0.0/compiler-1.\n0.0.pom](https://maven.google.com/android/arch/lifecycle/compiler/1.0.0/compiler-1.0.0.pom).\n\nOffline repository from SDK Manager\n\nFor libraries not available from the Google Maven repository (usually older\nlibrary versions), you must download the offline **Google Repository** package\nfrom the [SDK Manager](/studio/intro/update#sdk-manager).\n\nThen you can add these libraries to your `dependencies` block as usual.\n\nThe offline libraries are saved in\n\u003cvar translate=\"no\"\u003eandroid_sdk\u003c/var\u003e`/extras/`."]]