資訊一覽設定

本頁說明如何設定開發環境以使用 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 編譯器

請設定下列選項,確保 Compose 編譯器適用於 Glance:


android {
   buildFeatures {
      compose true
   }

   composeOptions {
      kotlinCompilerExtensionVersion = "1.5.15"
   }

   kotlinOptions {
      jvmTarget = "1.8"
   }
}