Android Gradle Plugin compileSdk=34 Warning
WARNING: This Android Gradle plugin (8.0.2) was tested up to compileSdk = 33.
We recommend using a newer Android Gradle plugin to use compileSdk = 34.
When configuring your Android project to target SDK 34 (compileSdk = 34
), you might encounter a warning stating your Android Gradle plugin version doesn't officially support this SDK level. This happens because new SDK releases require updates to the build tools for full compatibility.
Why This Warning Appears
Android Gradle plugins undergo testing against specific SDK versions. If you're using:
- An older plugin version (prior to 8.1.1)
compileSdk = 34
You'll see warnings because:
- The plugin lacks official testing with SDK 34
- Unverified compatibility might cause unexpected build issues
- New SDK features might not be fully supported
Recommended Solution: Update Plugin Version
// Update in project-level build.gradle
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
// Update to latest stable version (currently 8.4.0+)
classpath 'com.android.tools.build:gradle:8.4.0'
}
}
Execute these terminal commands afterward:
./gradlew wrapper --gradle-version=8.5 // Match with plugin requirements
./gradlew clean build
Verification Steps
After updating:
- Confirm no SDK 34 warnings appear
- Check build logs for plugin version
- Verify
compileSdkVersion 34
in module-level build.gradle
If using Android Studio:
- Open File > Project Structure > Project
- Set Android Gradle Plugin Version:
8.4.0
- Set Gradle Version:
8.5
Temporary Workaround (Not Recommended)
# Add to gradle.properties
android.suppressUnsupportedCompileSdk=34
Suppression Risks
This approach:
- Masks potential compatibility issues
- Doesn't fix underlying problems
- Should only be used temporarily
Troubleshooting
- If Android Studio blocks updates: Use File > Settings > Experimental and disable "Agree upgrade assistant"
- For beta channel features: Select Android Studio > Check for Updates and enable pre-release updates
- Check compatibility matrices: Android Gradle Plugin ReleasesGradle Compatibility
::: important Best Practices
- Always match
compileSdkVersion
with stable plugin versions - Avoid SDK previews in production builds
- Check release notes before major updates
- Test builds after plugin upgrades :::
// Module-level build.gradle example
android {
compileSdkVersion 34
defaultConfig {
applicationId "com.example.app"
minSdkVersion 24
targetSdkVersion 34
// ...
}
}
For ongoing compatibility:
- Subscribe to Android Releases RSS
- Use version catalogs for dependency management
- Run
./gradlew dependencyUpdates
regularly
Keeping your Android Gradle plugin updated ensures access to latest optimizations and prevents compatibility warnings when targeting new SDK versions.