Add components to your project

Before getting started, read the Guide to app architecture for useful principles that apply to all Android apps and for guidance on using architecture components together.

Architecture components are available from Google's Maven repository. To use them, add the repository to your project.

Open the settings.gradle file and add the google() repository:

dependencyResolutionManagement {
   ...
    repositories {
        google()
        jcenter()
    }
}
dependencyResolutionManagement {
    ...
    repositories {
        google()
        jcenter()
    }
}

Declare dependencies

Open the build.gradle file for your app or module and add the artifacts that you need as dependencies. You can add dependencies for all architecture components or choose a subset.

See the instructions for declaring dependencies for each architecture component in the release notes:

See AndroidX releases for the most up-to-date version numbers for each component.

For more information about the AndroidX refactor and how it affects these class packages and module IDs, see Migrate to AndroidX.

Kotlin

Kotlin extension modules are supported for several AndroidX dependencies. These modules have the suffix -ktx appended to their names. For example:

implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version"
implementation("androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version")

becomes

implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version")

More information, including docs for Kotlin extensions, can be found in the KTX documentation.

Note: For Kotlin based apps, make sure you use kapt instead of annotationProcessor. You should also add the kotlin-kapt plugin.

Explore this app architecture guide on UI layer libraries to learn about build environment, Android Studio support for data binding, and more.

Updated Feb 10, 2025

App architecture design is an important consideration for ensuring that your apps are robust, testable, and maintainable. Android provides a set of libraries and components to help you put together your app according to best practices.

Updated Feb 10, 2025

App architecture design is an important consideration for ensuring that your apps are robust, testable, and maintainable. Android provides a set of libraries and components to help you put together your app according to best practices.

Updated Feb 10, 2025