`androidx.core` requires new AGP version

I am facing the same issue along with another issue

Execution failed for task ‘:app:checkDebugAarMetadata’.

> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
> 2 issues were found when checking AAR metadata:

   1.  Dependency 'androidx.core:core:1.17.0' requires Android Gradle plugin 8.9.1 or higher.

       This build currently uses Android Gradle plugin 8.7.3.

   2.  Dependency 'androidx.core:core-ktx:1.17.0' requires Android Gradle plugin 8.9.1 or higher.

       This build currently uses Android Gradle plugin 8.7.3.

This error occurs on building the android part of a Flutter app. The error is probably due to some version mismatch somewhere I can’t see. I created a totally new project but still this is happening. I also changed android sdk or ndk recently through AS. Previously I had something on version 26 which got deleted while playing around with it but currently I have 28.1.13356709.

That’s not so much a Gradle question, it’s not even a Gradle error message, but one from the Android Gradle Plugin.

I recommend to ask in some Android or Flutter community if you need further help.

But the error message sounds quite clear to me. You depend on a version of androidx.core that requires a newer AGP version than you are using, so you probably need to downgrade that dependency or upgrade the used AGP.

I know about that but I wanted to know if they both are connected or not?

If what is connected?
Inability to sync the project and that error?

Probably not, the error you showed happens at task execution time: “Execution failed for task ‘:app:checkDebugAarMetadata’.”
Syncing the project should not be affected by a task execution problem usually.
But well, Android projects are always “a bit” special.

Where do you see the error?
In the Sync output?
If so, then probably yes.

I meant the original post error where you forked my post from. I gave all those details to figure out if both the errors are connected.

That was not clear from your post, as you did not ask about that, hence I forked it off as you seemed to just ask for your error, sorry.
But I just answered your question in my last reply.

yeah my bad.

But that original post is not about syncing error. It is about linking gradle project. Did you mean that?

It is about a project not being linked and that is usually because the sync failed, so in this context, they are partially the same.

Yeah, I think I can ignore it as it is only for the gradle or setings related files in android. Otherwise it is all working fine.

For anyone looking, I solved the error at the top by

changing settings.gradle file from

plugins {
    id("dev.flutter.flutter-plugin-loader") version "1.0.0"
    id("com.android.application") version "8.7.3" apply false

to

plugins {
id(“dev.flutter.flutter-plugin-loader”) version “1.0.0”
id(“com.android.application”) version “8.9.1” apply false
1 Like