このページでは、Glance を使用するための開発環境を設定する方法について説明します。利用可能な最新バージョンは、リリース ページから入手できます。
作成する「一目でわかる」コンテンツのタイプに基づいて、アプリのモジュールに特定の Glance 依存関係を追加します。
dependencies {
// For AppWidgets support
implementation "androidx.glance:glance-appwidget:1.1.1"
// For interop APIs with Material 3
implementation "androidx.glance:glance-material3:1.1.1"
// For interop APIs with Material 2
implementation "androidx.glance:glance-material:1.1.1"
}
Compose コンパイラを有効にする
次のオプションを設定して、Glance で Compose コンパイラを使用できるようにします。
android {
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.5.15"
}
kotlinOptions {
jvmTarget = "1.8"
}
}