上記のライブラリのいずれかをビルドに追加するには、最上位の 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/'.}}
[[["わかりやすい","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/`."]]