The build stops at checkDebugAarMetadata (or checkReleaseAarMetadata for release builds). This is the Android Gradle Plugin’s message, with a placeholder dependency name:
Execution failed for task ':app:checkDebugAarMetadata'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
> 1 issue was found when checking AAR metadata:
1. Dependency 'androidx.some:library:1.2.0' requires libraries and applications that
depend on it to compile against version 36 or later of the
Android APIs.
:app is currently compiled against android-35.
Recommended action: Update this project to use a newer compileSdk
of at least 36, for example 36.
Older AGP versions word it differently, and Flutter recognises that wording and prints its own fix (from the Flutter tool source):
Your project requires a higher compileSdk version.
Fix this issue by bumping the compileSdk version in .../android/app/build.gradle:
android {
compileSdk 36
}
You may also see this warning first, from Flutter’s Gradle plugin, naming the plugin that needs the newer SDK:
Warning: The plugin some_plugin requires Android SDK version 36 or higher.
Why it happens
Every Android library ships a small metadata file with the lowest compileSdk it needs. Your app has to compile against at least that version. Upgrading a package, or upgrading Flutter (which pulls in newer AndroidX libraries), raises that number, and an app with a hardcoded older compileSdk fails this check.
Fix: raise compileSdk
Open android/app/build.gradle.kts (or build.gradle) and look at compileSdk inside android { }:
android {
namespace = "com.example.app"
compileSdk = 36 // was 34 or 35
// or: compileSdk = flutter.compileSdkVersion
...
}
In Groovy, the line is compileSdk 36, or compileSdkVersion 36 in older projects.
- Use the number in the error, or higher.
flutter.compileSdkVersionis 36 on Flutter 3.35 and 3.50. New projects use it. If your file has a hardcoded number, switching to it keeps you in step with future Flutter upgrades.
Then rebuild:
flutter clean
flutter run
Does raising compileSdk change my app?
Not on its own. The Android message says it too: compileSdk can be updated “separately from updating targetSdk (which opts the app in to new runtime behavior) and minSdk (which determines which devices the app can be installed on)”.
- compileSdk: which Android APIs your code can see at build time. Safe to raise.
- targetSdk: which Android behaviour changes your app opts into. Google Play sets a yearly minimum: see the target API guide.
- minSdk: the oldest Android version that can install your app. Covered in “minSdkVersion cannot be smaller than”.
If it then says to upgrade the Android Gradle Plugin
Each AGP version has a maximum compileSdk it’s tested with. If yours is too old for 36, the same check adds “Recommended action: Update this project’s version of the Android Gradle plugin to one that supports 36”. compileSdk 36 needs AGP 8.9.1 or newer, and AGP 8.9.1 needs Gradle 8.11.1 or newer.
Paste your Gradle files into the Gradle and target API checker to get the exact versions to change. On Flutter 3.50 the minimums are higher anyway: the build stops below AGP 9.1.1 and Gradle 9.3.1, and AGP 9 has its own built-in Kotlin error.
Frequently asked questions
How do I fix "Execution failed for task ':app:checkDebugAarMetadata'"?
Read the line under it. Usually a dependency needs a higher compileSdk: set compileSdk to that number (for example 36) in android/app/build.gradle or build.gradle.kts, then run flutter clean and flutter run. If it asks for a newer Android Gradle Plugin, upgrade AGP and Gradle first.
What compileSdk does Flutter use?
flutter.compileSdkVersion is 36 on Flutter 3.35 and 3.50, and targetSdkVersion is also 36. Projects that use compileSdk = flutter.compileSdkVersion get it automatically.
Is raising compileSdk the same as raising targetSdk?
No. compileSdk only decides which Android APIs you can compile against and doesn’t change how your app behaves. targetSdk opts your app into new Android behaviour and is what Google Play’s yearly target API rule checks.
Stuck on a build or a store release? I fix and maintain Flutter apps, or tell me about your project. More fixes: all Flutter answers.