프로젝트에 구성요소 추가
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
시작하기 전에 앱 아키텍처 가이드에서 모든 Android 앱에 적용되는 유용한 원칙과 아키텍처 구성요소를 함께 사용하는 방법에 관한 안내를 읽어 보세요.
아키텍처 구성요소는 Google의 Maven 저장소에서 제공됩니다. 이러한 구성요소를 사용하려면 저장소를 프로젝트에 추가하세요.
settings.gradle
파일을 열고 google()
저장소를 추가합니다.
Groovy
dependencyResolutionManagement {
...
repositories {
google()
jcenter()
}
}
Kotlin
dependencyResolutionManagement {
...
repositories {
google()
jcenter()
}
}
종속 항목 선언
앱 또는 모듈의 build.gradle
파일을 열고 종속 항목으로 필요한 아티팩트를 추가합니다. 모든 아키텍처 구성요소의 종속 항목을 추가하거나 일부 종속 항목을 선택할 수 있습니다.
출시 노트에서 다음과 같은 각 아키텍처 구성요소의 종속 항목 선언 안내를 참고하세요.
각 구성요소의 최신 버전 번호는 AndroidX 출시를 참고하세요.
AndroidX 리팩터링과 이 리팩터링이 클래스 패키지 및 모듈 ID에 미치는 영향에 관한 자세한 내용은 AndroidX로 이전을 참고하세요.
Kotlin
여러 AndroidX 종속 항목에서 Kotlin 확장 모듈이 지원됩니다. 이러한 모듈의 이름에는 접미사 -ktx
가 추가됩니다. 예를 들면 다음과 같습니다.
Groovy
implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version"
Kotlin
implementation("androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version")
위 이름이 아래와 같이 변경됩니다.
Groovy
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
Kotlin
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version")
Kotlin 확장자 관련 문서를 포함하여 자세한 내용은 KTX 문서에서 확인할 수 있습니다.
참고: Kotlin 기반 앱에서는 annotationProcessor
대신 kapt
를 사용해야 합니다. 또한 kotlin-kapt
플러그인도 추가해야 합니다.
추천 서비스
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-27(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-07-27(UTC)"],[],[],null,["# Add components to your project\n\n[Issue Tracker](https://issuetracker.google.com/issues/new?component=197448&template=878802)\n\nReport issues so we can fix bugs.\n\nBefore getting started, read the\n[Guide to app architecture](/topic/architecture) for useful principles that\napply to all Android apps and for guidance on\nusing architecture components together.\n\nArchitecture components are available from Google's Maven repository. To use\nthem, add the repository to your project.\n\nOpen the `settings.gradle` file and add the `google()` repository: \n\n### Groovy\n\n```groovy\ndependencyResolutionManagement {\n ...\n repositories {\n google()\n jcenter()\n }\n}\n```\n\n### Kotlin\n\n```kotlin\ndependencyResolutionManagement {\n ...\n repositories {\n google()\n jcenter()\n }\n}\n```\n| **Warning:** The JCenter repository is read-only, as of March 31, 2021. For more information, see [JCenter service update](/studio/build/jcenter-migration).\n\nDeclare dependencies\n--------------------\n\nOpen the `build.gradle` file for your app or module and add the artifacts\nthat you need as dependencies. You can add dependencies for all architecture\ncomponents or choose a subset.\n\nSee the instructions for declaring dependencies for each architecture component in the release notes:\n\n- [Futures (found in androidx.concurrent)](/jetpack/androidx/releases/concurrent)\n- [Lifecycle (including ViewModel)](/jetpack/androidx/releases/lifecycle)\n- [Navigation (including SafeArgs)](/jetpack/androidx/releases/navigation)\n- [Paging](/jetpack/androidx/releases/paging)\n- [Room](/jetpack/androidx/releases/room)\n- [WorkManager](/jetpack/androidx/releases/work)\n\nSee [AndroidX releases](/jetpack/androidx/versions) for the most up-to-date\nversion numbers for each component.\n\nFor more information about the AndroidX refactor and how it affects these class\npackages and module IDs, see [Migrate to AndroidX](/jetpack/androidx/migrate).\n\nKotlin\n------\n\nKotlin extension modules are supported for several AndroidX dependencies. These\nmodules have the suffix `-ktx` appended to their names. For example: \n\n### Groovy\n\n```groovy\nimplementation \"androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version\"\n```\n\n### Kotlin\n\n```kotlin\nimplementation(\"androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version\")\n```\n\nbecomes \n\n### Groovy\n\n```groovy\nimplementation \"androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version\"\n```\n\n### Kotlin\n\n```kotlin\nimplementation(\"androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version\")\n```\n\nMore information, including docs for Kotlin extensions, can be found in the\n[KTX documentation](/kotlin/ktx).\n\n**Note:** For Kotlin based apps, make sure you use\n`kapt` instead of `annotationProcessor`. You should also\nadd the `kotlin-kapt` plugin.\n\nRecommended for you\n-------------------\n\n- Note: link text is displayed when JavaScript is off\n- [App Architecture: UI Layer - Get Started - Android Developers](/topic/libraries/data-binding/start)\n- [Work with observable data objects](/topic/libraries/data-binding/observability)\n- [Migrate from Kotlin synthetics to Jetpack view binding](/topic/libraries/view-binding/migration)"]]