Glance の設定

このページでは、Glance を使用するための開発環境の設定方法について説明します。

ビルドする「ひと目でわかる」タイプに基づいて、アプリのモジュールに特定の Glance の依存関係を追加します。

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

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

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

Compose Compiler を有効にする

次のオプションを設定して、Compose コンパイラが Glance で使用できるようにします。


android {
   buildFeatures {
      compose true
   }

   composeOptions {
      kotlinCompilerExtensionVersion = "1.5.13"
   }

   kotlinOptions {
      jvmTarget = "1.8"
   }
}

最新バージョンは Glance のリリースページから入手できます。