Flutter Build Fails with checkDebugAarMetadata Error After Upgrading to Flutter 3.29 (call_log plugin issue)

Flutter Build Fails with checkDebugAarMetadata Error After Upgrading to Flutter 3.29 (call_log plugin issue)

My Flutter project was originally built using Flutter 3.7, and everything was working fine, including the call_log plugin (call_log: ^3.0.3).
However, after upgrading to the latest stable version (Flutter 3.19.2), I'm now getting the following error during build:

* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
   > An issue was found when checking AAR metadata:

       1.  Dependency ':call_log' requires core library desugaring to be enabled
           for :app.

           See https://developer.android.com/studio/write/java8-support.html for more
           details.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 3m 58s
Error: Gradle task assembleDebug failed with exit code 1

My Setup

  • Flutter version: 3.29.2 (stable)
  • Previously working with: Flutter 3.7
  • call_log plugin version: ^3.0.3
  • Using Kotlin DSL (build.gradle.kts)
  • Java version: 17
  • NDK version: 27.0.12077973

How can I resolve this checkDebugAarMetadata failure related to core library desugaring when using call_log with the latest stable Flutter version?

Answer

How I fixed this, I updated my android/app/build.gradle.kts like this:

android {
    namespace = "com.example.password_manager"
    compileSdk = flutter.compileSdkVersion
    ndkVersion = "27.0.12077973"

    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_11
        targetCompatibility = JavaVersion.VERSION_11
        isCoreLibraryDesugaringEnabled = true // Enables Java 8+ APIs for core libs
    }

    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_11.toString()
    }

    defaultConfig {
        applicationId = "com.example.password_manager"
        minSdk = flutter.minSdkVersion
        targetSdk = flutter.targetSdkVersion
        versionCode = flutter.versionCode
        versionName = flutter.versionName
        multiDexEnabled = true // Optional but helpful for larger apps
    }
}

//added dependencies
dependencies {
    // Use the required version of desugar_jdk_libs
    coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.4")
}

Than did a clean build :

flutter clean
flutter pub get
flutter build apk

Enjoyed this article?

Check out more content on our blog or follow us on social media.

Browse more articles