Skip to content

Android Gradle Plugin (AGP) Version Compatibility

Problem Overview

When working with Android projects, you might encounter an error message similar to:

The project is using an incompatible version (AGP X.X.X) of the Android Gradle plugin. Latest supported version is AGP Y.Y.Y

This error occurs when your Android Studio version doesn't support the Android Gradle Plugin (AGP) version specified in your project. This commonly happens when:

  • Importing projects from GitHub or other sources
  • Downgrading Android Studio to a previous version
  • Opening projects created with newer Android Studio versions
  • Having outdated Android Studio installation

Solutions

The most straightforward solution is to update your Android Studio to the latest version:

bash
Android Studio Check for Updates Update Now
bash
Help Check for Updates Update Now

TIP

For Mac users: Use Cmd + , to open Preferences, then navigate to Appearance & Behavior → System Settings → Updates

Updating ensures you have the latest AGP support and access to newest features.

Option 2: Modify AGP Version in Project Files

If you cannot update Android Studio, manually adjust the AGP version to match your IDE's supported version.

For Traditional build.gradle files:

gradle
// In project-level build.gradle
buildscript {
    dependencies {
        classpath 'com.android.tools.build:gradle:7.2.1' // Change to your supported version
        // Other dependencies...
    }
}

For Kotlin DSL build.gradle.kts:

kotlin
plugins {
    id("com.android.application") version "7.2.2" // Your compatible version
    // Other plugins...
}

For projects using libs.versions.toml:

toml
[versions]
agp = "8.2.2" # Change to your compatible version

[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }

WARNING

When changing AGP versions, you may need to adjust other dependencies (like Kotlin version) to maintain compatibility.

Option 3: Using Android Studio's Project Structure

  1. Open File → Project Structure
  2. Select the Project section
  3. Choose a compatible AGP version from the dropdown menu
  4. Click OK and sync your project

Version Compatibility Reference

Android Studio and AGP versions must be compatible. Here's a general guideline (check Android Studio's official documentation for exact matches):

Android Studio VersionSupported AGP Versions
Hedgehog (2023.1.1)~8.2.2
Giraffe (2022.3.1)~8.1.0
Flamingo (2022.2.1)~7.3.0
Electric Eel (2022.1.1)~7.2.0
Dolphin (2021.3.1)~7.1.0

INFO

Always check the official Android Studio and AGP compatibility table for exact version matching.

Best Practices

  1. Keep Android Studio updated to avoid compatibility issues
  2. Document AGP versions in team projects to ensure consistency
  3. Use version catalogs (libs.versions.toml) for easier version management
  4. Check compatibility before importing external projects

Troubleshooting Tips

If you continue experiencing issues:

  1. Invalidate caches: File → Invalidate Caches / Restart
  2. Clean project: Build → Clean Project, then Build → Rebuild Project
  3. Check Gradle wrapper: Ensure gradle-wrapper.properties uses a compatible Gradle version

DANGER

Avoid the nuclear option of completely uninstalling and reinstalling Android Studio unless absolutely necessary, as this is rarely required to resolve AGP version conflicts.

By following these steps, you should be able to resolve AGP version compatibility issues and continue working on your Android projects seamlessly.