Skip to content

A fully functional Android app built entirely with Kotlin and Jetpack Compose

Add dependency for Compose Previews to render

Caren Chang2e4c763db55f
diff --git a/core-ui/build.gradle.kts b/core-ui/build.gradle.kts
index f71e9af3b..7fade59be 100644
--- a/core-ui/build.gradle.kts
+++ b/core-ui/build.gradle.kts
@@ -28,10 +28,11 @@ dependencies {
implementation(libs.coil.kt.compose)
implementation(libs.kotlinx.datetime)
- // TODO : Remove these dependencies when b/225193889 is fixed
- // These dependencies are currently necessary to render Compose previews
- debugImplementation("androidx.savedstate:savedstate-ktx:1.1.0")
+ // TODO : Remove these dependency once we upgrade to Android Studio Dolphin b/228889042
+ // These dependencies are currently necessary to render Compose previews
+ debugImplementation(libs.androidx.customview.poolingcontainer)
debugImplementation(libs.androidx.lifecycle.viewModelCompose)
+ debugImplementation(libs.androidx.savedstate.ktx)
api(libs.androidx.compose.foundation)
api(libs.androidx.compose.foundation.layout)
diff --git a/feature-following/build.gradle.kts b/feature-following/build.gradle.kts
index ecc16eb5c..1c42e1bdf 100644
--- a/feature-following/build.gradle.kts
+++ b/feature-following/build.gradle.kts
@@ -47,6 +47,10 @@ dependencies {
implementation(libs.hilt.android)
kapt(libs.hilt.compiler)
+ // TODO : Remove this dependency once we upgrade to Android Studio Dolphin b/228889042
+ // These dependencies are currently necessary to render Compose previews
+ debugImplementation(libs.androidx.customview.poolingcontainer)
+
// androidx.test is forcing JUnit, 4.12. This forces it to use 4.13
configurations.configureEach {
resolutionStrategy {
diff --git a/feature-foryou/build.gradle.kts b/feature-foryou/build.gradle.kts
index 0b75ef98e..efaa4e4ad 100644
--- a/feature-foryou/build.gradle.kts
+++ b/feature-foryou/build.gradle.kts
@@ -24,7 +24,8 @@ plugins {
android {
defaultConfig {
- testInstrumentationRunner = "com.google.samples.apps.nowinandroid.core.testing.NiaTestRunner"
+ testInstrumentationRunner =
+ "com.google.samples.apps.nowinandroid.core.testing.NiaTestRunner"
}
}
@@ -50,6 +51,10 @@ dependencies {
implementation(libs.hilt.android)
kapt(libs.hilt.compiler)
+ // TODO : Remove this dependency once we upgrade to Android Studio Dolphin b/228889042
+ // These dependencies are currently necessary to render Compose previews
+ debugImplementation(libs.androidx.customview.poolingcontainer)
+
// androidx.test is forcing JUnit, 4.12. This forces it to use 4.13
configurations.configureEach {
resolutionStrategy {
diff --git a/feature-topic/build.gradle.kts b/feature-topic/build.gradle.kts
index 49dff3974..4ff7a6e5e 100644
--- a/feature-topic/build.gradle.kts
+++ b/feature-topic/build.gradle.kts
@@ -46,6 +46,10 @@ dependencies {
implementation(libs.hilt.android)
kapt(libs.hilt.compiler)
+ // TODO : Remove this dependency once we upgrade to Android Studio Dolphin b/228889042
+ // These dependencies are currently necessary to render Compose previews
+ debugImplementation(libs.androidx.customview.poolingcontainer)
+
// androidx.test is forcing JUnit, 4.12. This forces it to use 4.13
configurations.configureEach {
resolutionStrategy {
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 473161219..850c93bfd 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -7,6 +7,7 @@ androidxAppCompat = "1.3.0"
androidxCompose = "1.2.0-alpha08"
androidxComposeMaterial3 = "1.0.0-alpha10"
androidxCore = "1.7.0"
+androidxCustomView = "1.0.0-alpha01"
androidxDataStore = "1.0.0"
androidxEspresso = "3.3.0"
androidxHiltNavigationCompose = "1.0.0-rc01"
@@ -14,6 +15,7 @@ androidxLifecycle = "2.5.0-beta01"
androidxMacroBenchmark = "1.1.0-beta04"
androidxNavigation = "2.4.0-rc01"
androidxProfileinstaller = "1.2.0-alpha02"
+androidxSavedState = "1.1.0"
androidxStartup = "1.1.1"
androidxWindowManager = "1.0.0"
androidxTest = "1.4.0"
@@ -63,12 +65,14 @@ androidx-compose-ui-tooling = { group = "androidx.compose.ui", name = "ui-toolin
androidx-compose-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview", version.ref = "androidxCompose" }
androidx-compose-ui-util = { group = "androidx.compose.ui", name = "ui-util", version.ref = "androidxCompose" }
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidxCore" }
+androidx-customview-poolingcontainer = { group = "androidx.customview", name = "customview-poolingcontainer", version.ref = "androidxCustomView"}
androidx-dataStore-core = { group = "androidx.datastore", name = "datastore", version.ref = "androidxDataStore" }
androidx-dataStore-preferences = { group = "androidx.datastore", name = "datastore-preferences", version.ref = "androidxDataStore" }
androidx-hilt-navigation-compose = { group = "androidx.hilt", name = "hilt-navigation-compose", version.ref = "androidxHiltNavigationCompose" }
androidx-lifecycle-viewModelCompose = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-compose", version.ref = "androidxLifecycle" }
androidx-navigation-compose = { group = "androidx.navigation", name = "navigation-compose", version.ref = "androidxNavigation" }
androidx-profileinstaller = { group = "androidx.profileinstaller", name = "profileinstaller", version.ref = "androidxProfileinstaller" }
+androidx-savedstate-ktx = { group = "androidx.savedstate", name = "savedstate-ktx", version.ref= "androidxSavedState"}
androidx-startup = { group = "androidx.startup", name = "startup-runtime", version.ref = "androidxStartup" }
androidx-window-manager = {module = "androidx.window:window", version.ref = "androidxWindowManager"}
androidx-test-core = { group = "androidx.test", name = "core", version.ref = "androidxTest" }