Skip to content

Android Gradle Plugin compileSdk=34 Warning

markdown
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:

  1. The plugin lacks official testing with SDK 34
  2. Unverified compatibility might cause unexpected build issues
  3. New SDK features might not be fully supported
gradle
// 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:

bash
./gradlew wrapper --gradle-version=8.5  // Match with plugin requirements
./gradlew clean build

Verification Steps

After updating:

  1. Confirm no SDK 34 warnings appear
  2. Check build logs for plugin version
  3. Verify compileSdkVersion 34 in module-level build.gradle

If using Android Studio:

  1. Open File > Project Structure > Project
  2. Set Android Gradle Plugin Version: 8.4.0
  3. Set Gradle Version: 8.5
properties
# 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 :::
gradle
// Module-level build.gradle example
android {
    compileSdkVersion 34
    
    defaultConfig {
        applicationId "com.example.app"
        minSdkVersion 24
        targetSdkVersion 34
        // ...
    }
}

For ongoing compatibility:

  1. Subscribe to Android Releases RSS
  2. Use version catalogs for dependency management
  3. Run ./gradlew dependencyUpdates regularly

Keeping your Android Gradle plugin updated ensures access to latest optimizations and prevents compatibility warnings when targeting new SDK versions.