Glance setup

This page describes how to set up your development environment to use Glance.

Prerequisites

Glance relies on Compose Runtime and some Android SDK v31 methods. To use Glance, your project requires the following:

  • Android Gradle Plugin (AGP) version 7.0.0 or above
  • The Kotlin version that the compose compiler depends on. See the release notes for more information.
  • Compose Runtime version 1.1.0 or above
  • Android Compile SDK version 31 or above
  • Android Min. SDK 21 or above

If your app is not configured to use Compose, follow the steps in Set up Compose for an existing app.

Add Glance dependencies

Add the specific Glance dependency in your app's module based on the features you need:

dependencies {
   // For AppWidgets support
   implementation "androidx.glance:glance-appwidget:1.0.0"

   // For interop APIs with Material 2
   implementation "androidx.glance:glance-material:1.0.0"

   // For interop APIs with Material 3
   implementation "androidx.glance:glance-material3:1.0.0"

}

You can get the latest available version from the Glance release page.