הגדרה של 'בקצרה'

בדף הזה מוסבר איך להגדיר את סביבת הפיתוח כך שתעבוד עם Glance. אפשר להוריד את הגרסה העדכנית ביותר מדף הגרסאות.

מוסיפים את התלות הספציפית ב-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

כדי לוודא שהקומפיילר של Compose זמין ל-Glance, מגדירים את האפשרויות הבאות:


android {
   buildFeatures {
      compose true
   }

   composeOptions {
      kotlinCompilerExtensionVersion = "1.5.15"
   }

   kotlinOptions {
      jvmTarget = "1.8"
   }
}