Adding Components to your Project

Before getting started, we recommend reading the Architecture Components Guide to App Architecture. The guide has some useful principles that apply to all Android apps, and shows how to use the Architecture Components together.

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

Open the build.gradle file for your project (not the ones for your app or module) and add the google() repository as shown below:

allprojects {
    repositories {

Declaring 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 the AndroidX refactor documentation.


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-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.