How to fix this NDK mismatch error for flutter_local_notifications?

Before the question I tried the suggested fix, hard-coding that NDK version, multiple times, it FAILED. Also I tried installing fresh, EVERYTHING FROM ANDROID STUDIO. IT DIDN’T WORK. PLEASE HELP ME ON THIS, JUST WANNA USE NOTIFICATION SERVICES.

Here’s what I see:

Your project is configured with Android NDK 26.3.11579264, but the following plugin(s) depend on a different Android NDK version:

  • flutter_local_notifications requires Android NDK 27.0.12077973
    Fix this issue by using the highest Android NDK version (they are backward compatible).
    Add the following to /home/moss/StudioProjects/trackit/android/app/build.gradle.kts:

    android {
    ndkVersion = “27.0.12077973”

    }

FAILURE: Build failed with an exception.

  • 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 ':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.
  • 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 38s
Running Gradle task ‘assembleDebug’… 39.0s
Error: Gradle task assembleDebug failed with exit code 1

it told you what to do

about the desugaring issue, read the package readme it says how to add desugaring

1 Like

I’ve fixed same issue.

I can help you.

1 Like

Please help me with this, then.

Hi Mihalycsaba, thank you for your reply. I mean really. Which readme are you talking about? This one: Java 8+ APIs available through desugaring  |  Android Studio  |  Android Developers ? I will do that. Once again I really mean it. Thanks for this. I will try this once again.

Add
app/build.gradle

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
coreLibraryDesugaringEnabled true //add this line
}

dependencies {
coreLibraryDesugaring ‘com.android.tools:desugar_jdk_libs:2.1.4’
}

then sync the gradle, then try,

Thanks Abhishek I’ll try this and let you know if it worked