A library needs a higher compileSdk than your module sets
Dependency 'androidx.core:core:1.x.x' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs.Short answer
A dependency declares a minimum compileSdk, and your module compiles against a lower one. The build fails at checkAarMetadata. Raise compileSdk in the module that fails to the number in the message. If the Android Gradle plugin does not support that level, update the plugin before you raise it.
Fix it fast
1Find out which cause you have
Read the whole message. It names the dependency, the level it needs and the level your module uses. Then see where compileSdk is set.
./gradlew :app:checkDebugAarMetadata grep -rn "compileSdk" --include=*.gradle --include=*.kts .2Match what you see, then jump to its fix
- 1
:app is currently compiled against android-33 (or lower than the number in the message)compileSdk is lower than the library's minimumFix - 2
After you raise compileSdk, the build warns that the plugin was not tested with that levelThe Android Gradle plugin is too old for that API levelFix - 3
You do not use the named library directly, and it appeared after a version bump of another dependencyA transitive dependency pulled in a newer libraryFix
- 1
What does the error look like?
Dependency 'androidx.core:core:1.x.x' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs.Execution failed for task ':app:checkDebugAarMetadata'.:app is currently compiled against android-33.
Cause 1 of 3
compileSdk is lower than the library's minimum
1Check
A library can publish a minimum compileSdk in its AAR metadata. Consumers must meet it, otherwise Gradle reports it up front instead of failing later with a resource-not-found error.
grep -rn "compileSdk" --include=*.gradle --include=*.kts .2Fix
Set compileSdk to the level the message asks for, or higher, in the module that fails. Install the matching platform in SDK Manager if it is missing.
// app/build.gradle.kts
android {
compileSdk = 36
}
# install the platform
sdkmanager --install "platforms;android-36"3Verify
Run the check again.
./gradlew :app:checkDebugAarMetadataConfirmed by developer.android.com
Cause 2 of 3
The Android Gradle plugin is too old for that API level
1Check
Each AGP release states the highest API level it supports. AGP 9.5, for example, supports up to API level 37, and needs Gradle 9.6.0 and JDK 17.
grep -rn "com.android.application\|agp" gradle/libs.versions.toml build.gradle* 2>/dev/null
cat gradle/wrapper/gradle-wrapper.properties2Fix
Raise the AGP version, and the Gradle wrapper to the minimum that AGP needs, then raise compileSdk.
# gradle/libs.versions.toml
agp = "9.5.1"
# then sync; set the wrapper to the Gradle version AGP lists as its minimum3Verify
Sync, and the checkAarMetadata task passes.
./gradlew :app:checkDebugAarMetadataConfirmed by developer.android.com
Cause 3 of 3
A transitive dependency pulled in a newer library
1Check
List the dependency tree and find which library brings the named one in.
./gradlew :app:dependencies --configuration debugRuntimeClasspath | grep -n "androidx.core"2Fix
Preferably raise compileSdk. Or pin the older version of the dependency in your version catalog, until you can upgrade.
# gradle/libs.versions.toml
[versions]
androidx-core = "1.12.0"3Verify
The dependency tree shows the older version and the check passes.
./gradlew :app:checkDebugAarMetadataConfirmed by developer.android.com
How do I stop it coming back?
- Update compileSdk each year with the new Android release, and update AGP in the same change.
- Upgrade AndroidX libraries in small steps and run a build after each bump.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Mobile apps
Gradle will not install an Android SDK package until you accept its licence
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
Gradle tried to download an SDK package, but the licence for it is not recorded on this machine.
3 causes, each with a fixMobile apps
adb cannot start because something already holds its port
adb start-server failed
The adb server must bind local TCP port 5037, and every adb client talks to it there.
2 causes, each with a fixMobile apps
The phone shows as unauthorized and Android Studio will not run the app
adb devices lists the phone but Android Studio cannot deploy to it
An unauthorized phone means it has not trusted this computer's RSA key.
3 causes, each with a fixMobile apps
Android Studio cannot pair the phone over Wi-Fi
The Pair devices over Wi-Fi dialog lists no device
Wireless pairing needs the phone on Android 11 or higher and on the same Wi-Fi network as the computer, with current Platform-Tools.
4 causes, each with a fixMobile apps
adb cannot connect to its daemon or start the server
* daemon started successfully *
The adb server is a background process on your computer that listens on TCP port 5037.
2 causes, each with a fixMobile apps
adb prints 'server version doesn't match this client; killing...'
adb server version doesn't match this client; killing...
adb runs a background server, and every adb command is a client.
3 causes, each with a fix