We just launched Compose Examples featuring over 150+ components! Check it out β†’
This article was posted more than a year ago. The author's opinions, the state of technology and the world might have changed since then.

Jetpack Compose 1.2.0 & Jetpack Compose Wear 1.0.0 are out

by @alexstyl
#news
#compose

Jetpack Compose 1.2.0 and Jetpack Compose Wear 1.0.0 were released today. Here is the summary of what changed.

This article was featured in Android Weekly #529 πŸŽ‰

What's new in Jetpack Compose 1.2.0

The following APIs are now part of the stable release:

New Experimental APIs

Bug Fixes

Most notable bug fixes:

  • Animations now follow the "Animation duration scale" developer setting.
  • TextField now handles button button presses the same was as EditText does.

How to install Jetpack Compose 1.2.0 in your Android project

Make sure to include Jetpack Compose in your project, then update the dependencies in your app/build.gradle file:

dependencies {
    implementation "androidx.compose.animation:animation:1.2.0"
    implementation "androidx.compose.foundation:foundation:1.2.0"
    implementation "androidx.compose.material:material:1.2.0"
    implementation "androidx.compose.runtime:runtime:1.2.0"
    implementation "androidx.compose.ui:ui:1.2.0"
}

What's new in Jetpack Compose Wear 1.0.0

This is the 1.0.0 release. Includes new wear specific Compose dependencies with a variety of Wear composables.

There is a new Google library called Horologist that brings support to common patterns that are not available to Compose yet (seems like the Wear version of Accompanist).

New Preview available for Wearable devices:

import androidx.compose.ui.tooling.preview

@Preview(
    device = Devices.WEAR_OS_LARGE_ROUND,
    showSystemUi = true,
    backgroundColor = 0xff000000,
    showBackground = true
)
@Composable
fun PreviewCustomComposable() {
    CustomComposable(...)
}

How to install Jetpack Compose for Wear

Add the respective wear dependencies in your app/build.gradle file:

dependencies {
    implementation "androidx.compose.animation:animation:1.2.0"
    implementation "androidx.compose.foundation:foundation:1.2.0"
    implementation "androidx.compose.runtime:runtime:1.2.0"
    implementation "androidx.compose.ui:ui:1.2.0"

    // wear dependencies
    implementation "androidx.wear.compose:compose-foundation:1.0.0"
    implementation "androidx.wear.compose:compose-material:1.0.0"
    implementation "androidx.wear.compose:compose-navigation:1.0.0"
}

WARNING: Do not include androidx.compose.material:material in your wear project.

According to the documentation these are the difference in dependencies you have to use:

Wear OS Dependency (androidx.wear.*)ComparisonMobile Dependency (androidx.*)
androidx.wear.compose:compose-materialinstead ofandroidx.compose.material:material
androidx.wear.compose:compose-navigationinstead ofandroidx.navigation:navigation-compose
androidx.wear.compose:compose-foundationin addition toandroidx.compose.foundation:foundation

Read the full update at the official Compose 1.2.0 announcement and Compose Wear 1.0.0 announcement


by @alexstyl