[#59] Enable core library desugaring for app module

Note that if we want to run tests from each module on older Android versions, we would need to enable desugaring for each module that is using newer JDK features.  For now, this prevents the app itself from crashing on devices with older versions of Android
This commit is contained in:
Carter Jernigan 2021-11-09 13:53:20 -05:00
parent 575b3063bf
commit 3ede7ac8f0
3 changed files with 9 additions and 0 deletions

View File

@ -15,6 +15,10 @@ android {
versionName = "1.0"
}
compileOptions {
isCoreLibraryDesugaringEnabled = true
}
flavorDimensions.add("network")
productFlavors {
@ -76,6 +80,8 @@ android {
}
dependencies {
coreLibraryDesugaring(libs.desugaring)
implementation(libs.androidx.activity)
implementation(libs.androidx.annotation)
implementation(libs.androidx.core)

View File

@ -65,6 +65,7 @@ ANDROIDX_TEST_VERSION=1.4.1-alpha03
ANDROIDX_TEST_JUNIT_VERSION=1.1.3
ANDROIDX_TEST_ORCHESTRATOR_VERSION=1.4.1-alpha03
ANDROIDX_UI_AUTOMATOR_VERSION=2.2.0-alpha1
CORE_LIBRARY_DESUGARING_VERSION=1.1.5
GOOGLE_MATERIAL_VERSION=1.4.0
JACOCO_VERSION=0.8.7
KOTLINX_COROUTINES_VERSION=1.5.2

View File

@ -59,6 +59,7 @@ dependencyResolutionManagement {
val androidxTestVersion = extra["ANDROIDX_TEST_VERSION"].toString()
val androidxUiAutomatorVersion = extra["ANDROIDX_UI_AUTOMATOR_VERSION"].toString()
val androidxSecurityCryptoVersion = extra["ANDROIDX_SECURITY_CRYPTO_VERSION"].toString()
val coreLibraryDesugaringVersion = extra["CORE_LIBRARY_DESUGARING_VERSION"].toString()
val googleMaterialVersion = extra["GOOGLE_MATERIAL_VERSION"].toString()
val jacocoVersion = extra["JACOCO_VERSION"].toString()
val javaVersion = extra["ANDROID_JVM_TARGET"].toString()
@ -86,6 +87,7 @@ dependencyResolutionManagement {
alias("androidx-lifecycle-livedata").to("androidx.lifecycle:lifecycle-livedata-ktx:$androidxLifecycleVersion")
alias("androidx-security-crypto").to("androidx.security:security-crypto-ktx:$androidxSecurityCryptoVersion")
alias("androidx-viewmodel-compose").to("androidx.lifecycle:lifecycle-viewmodel-compose:$androidxLifecycleVersion")
alias("desugaring").to("com.android.tools:desugar_jdk_libs:$coreLibraryDesugaringVersion")
alias("google-material").to("com.google.android.material:material:$googleMaterialVersion")
alias("kotlin").to("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion")
alias("kotlinx-coroutines-android").to("org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlinxCoroutinesVersion")