From 385efe2dce50a84bff39d95d526c07418663a89d Mon Sep 17 00:00:00 2001 From: Pouya Heydari Date: Sun, 22 Sep 2024 00:31:11 +0200 Subject: [PATCH] Added desugaring to prevent crashes on api < 26 as kotlinx.datetime is using Java.Instant under the hood. --- app/build.gradle.kts | 4 ++++ gradle/libs.versions.toml | 2 ++ 2 files changed, 6 insertions(+) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 5cd3fa9..3bf7f4c 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -28,6 +28,7 @@ android { } } compileOptions { + isCoreLibraryDesugaringEnabled = true sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } @@ -47,6 +48,9 @@ dependencies { implementation(projects.core) implementation(projects.features.calendarDetails) implementation(libs.androidx.core) + + // Datetime + coreLibraryDesugaring(libs.desugar.jdk.libs) implementation(libs.kotlinx.datetime) // Support diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 8cc55c6..351b00d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,7 @@ [versions] appVersion = "614" compileSdkVersion = "34" +desugar_jdk_libs = "2.1.2" glance = "1.1.0" javaxInject = "1" kotlinxDatetime = "0.6.1" @@ -36,6 +37,7 @@ crashlyticsVersion = "3.0.2" [libraries] appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" } constraintLayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintLayout" } +desugar_jdk_libs = { module = "com.android.tools:desugar_jdk_libs", version.ref = "desugar_jdk_libs" } javax-inject = { module = "javax.inject:javax.inject", version.ref = "javaxInject" } kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinxDatetime" } recyclerView = { group = "androidx.recyclerview", name = "recyclerview", version.ref = "recyclerView" }