Getting started with Android Jetpack

Jetpack encompasses a collection of Android libraries that incorporate best practices and provide backwards compatibility in your Android apps.

The Jetpack guide to app architecture provides an overview of the best practices and recommended architecture to consider as you build your Android app.

The following sections cover how you can get started using Jetpack components.

Use a Jetpack library in your app

All Jetpack components are available on the Google Maven repository.

Open the build.gradle file for your project and add the google() repository as shown below:

allprojects {
    repositories {
        google()
        jcenter()
    }
}

You can then add Jetpack components, such as architecture components like LiveData and ViewModel that are part of the Lifecycles library, as shown here:

dependencies {
    def lifecycle_version = "2.0.0"
    implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
    // Optional : Kotlin extension (https://d.android.com/kotlin/ktx)
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
    ...
}

Many Jetpack libraries also provide Android KTX extensions as shown above in the lifecycle-viewmodel-ktx. The KTX extensions build upon the Java-based API, taking advantage of Kotlin-specific language features.

To learn of new Jetpack library releases, check out the Releases page.

Kotlin-based and Java-based API reference pages are available for all Jetpack libraries.

Take advantage of Jetpack

Jetpack components may be used as standalone components or in combination to address different needs in your applications.

  • WorkManager for your background scheduling needs.
  • Room for data storage persistence.
  • Navigation to manage your application navigation flow.
  • CameraX for your camera app needs.
  • (More)

To learn more about using Jetpack, check out these pages:

Additional resources

Online training

Sample code

  • The Sunflower demo app uses many different Jetpack components to demonstrate Android development best practices.

Codelabs