Bevor du beginnst, lies dir die
Leitfaden zur App-Architektur mit nützlichen Prinzipien, die
auf alle Android-Apps anwenden und
Architekturkomponenten zusammen verwenden.
Architekturkomponenten sind im Maven-Repository von Google verfügbar. Zur Verwendung
fügen Sie das Repository Ihrem Projekt hinzu.
Öffnen Sie die Datei settings.gradle und fügen Sie das Repository google() hinzu:
Öffnen Sie die Datei build.gradle für Ihre App oder Ihr Modul und fügen Sie die Artefakte hinzu
die Sie als Abhängigkeiten benötigen. Sie können Abhängigkeiten für alle Architekturen hinzufügen
oder eine Teilmenge auswählen.
Eine Anleitung zum Deklarieren von Abhängigkeiten für die einzelnen Architekturkomponenten finden Sie in den Versionshinweisen:
Weitere Informationen zur AndroidX-Refaktorierung und zu den Auswirkungen auf diese Klasse
Pakete und Modul-IDs finden Sie unter Zu AndroidX migrieren.
Kotlin
Kotlin-Erweiterungsmodule werden für verschiedene AndroidX-Abhängigkeiten unterstützt. Diese
An den Namen der Module wird das Suffix -ktx angehängt. Beispiel:
Alle Inhalte und Codebeispiele auf dieser Seite unterliegen den Lizenzen wie im Abschnitt Inhaltslizenz beschrieben. Java und OpenJDK sind Marken oder eingetragene Marken von Oracle und/oder seinen Tochtergesellschaften.
Zuletzt aktualisiert: 2025-07-27 (UTC).
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Benötigte Informationen nicht gefunden","missingTheInformationINeed","thumb-down"],["Zu umständlich/zu viele Schritte","tooComplicatedTooManySteps","thumb-down"],["Nicht mehr aktuell","outOfDate","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Problem mit Beispielen/Code","samplesCodeIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 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)"]]