How to Fix Core Library Desugaring and Java Version Warnings After Upgrading to Flutter 3.27.3

Ayesha Iftikhar
3 min readFeb 3, 2025

After upgrading to Flutter 3.27.3, developers may encounter errors related to core library desugaring and Java version compatibility while building APKs or app bundles. This article provides a step-by-step guide to resolve these issues, including enabling core library desugaring, updating Java version settings, and modifying Gradle configurations to ensure a smooth build process.

Dependency ‘:flutter_local_notifications’ requires core library desugaring to be enabled for :app.

Here how, you can fix it quickly:

Add the following in android>app>build.grable :

compileOptions {
...
coreLibraryDesugaringEnabled true
}
dependencies {
implementation 'androidx.window:window:1.0.0'
implementation 'androidx.window:window-java:1.0.0'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.3'
}

If you have recently upgraded your Java version to 21, you might be getting these following warnings:

To fix or remove this warning you might need to change the following files:

  • In android/app/build.gradle :
// change
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}
// to
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17
}

In gradle/wrapper/gradle-wrapper.properties change your distributionUrl to the following:

distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip

In some cases, you might want to update com.android.application in android/setting.gradle file.

id "com.android.application" version "8.5.0" apply false

Conclusion:
Upgrading to Flutter 3.27.3 can introduce challenges related to core library desugaring and Java version compatibility, but these issues can be resolved with a few adjustments to your project’s configuration files. By enabling core library desugaring, updating the Java version settings, and ensuring your Gradle configurations are up-to-date, you can eliminate build errors and warnings. Following these steps will help you maintain a seamless development workflow and keep your Flutter projects running smoothly.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Ayesha Iftikhar
Ayesha Iftikhar

Written by Ayesha Iftikhar

I am professional software engineer with experience of around 4 years in Mobile Application Development using Flutter and overall 5 years of experience in IT.

No responses yet

What are your thoughts?