Skip to content

Commit baed78b

Browse files
rajveermalviyagnprice
authored andcommitted
android build: Enable core library desugaring, needed by flutter_local_notifications
This applies an Android setup step called for by package:flutter_local_notifications: https://github.com/MaikuB/flutter_local_notifications/tree/d565daab613052fecaf723df865101b46ee5a26a/flutter_local_notifications#gradle-setup namely enabling core-library desugaring: https://developer.android.com/studio/write/java8-support#library-desugaring We seem to have been fine without that step so far. But after the upcoming upgrade to AGP 8.5.2 (from 8.1.4), the build starts giving an error demanding this change: Execution failed for task ':app:checkReleaseAarMetadata'. > A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction > An issue was found when checking AAR metadata: 1. Dependency ':flutter_local_notifications' requires core library desugaring to be enabled for :app. See https://developer.android.com/studio/write/java8-support.html for more details. [greg: expanded commit message, added comment]
1 parent 7f01573 commit baed78b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

android/app/build.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ android {
2828
compileOptions {
2929
sourceCompatibility JavaVersion.VERSION_1_8
3030
targetCompatibility JavaVersion.VERSION_1_8
31+
32+
// The use of desugar_jdk_libs causes warning noise at build time:
33+
// https://github.com/zulip/zulip-flutter/pull/887#issuecomment-2287653388
34+
// https://issuetracker.google.com/issues/294273986
35+
// TODO(#351): Try removing core-library desugaring once we've
36+
// removed flutter_local_notifications.
37+
coreLibraryDesugaringEnabled true
3138
}
3239

3340
kotlinOptions {
@@ -97,4 +104,5 @@ flutter {
97104

98105
dependencies {
99106
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
107+
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:2.0.4"
100108
}

0 commit comments

Comments
 (0)