The project is using an incompatible version (AGP 7.3.0-alpha07) of the Android Gradle plugin
Asked Answered
A

16

85

I want to use architecture project (todo list) but get this error when i want to run project

The project is using an incompatible version (AGP 7.3.0-alpha07) of the Android Gradle plugin. Latest supported version is AGP 7.2.1

Articular answered 25/5, 2022 at 17:45 Comment(0)
P
16

Update to the latest version of Android Studio i.e. Dolphin and your problem will be resolved

Proverbial answered 13/10, 2022 at 11:0 Comment(4)
The same here with me.Thimbleweed
In my case it's not a good variant because a project compiles in Chipmunk and doesn't compile in Dolphin.Bard
Upgraded to Dolphin and still getting the errorCohune
Thanks. Android Studio gives a link, "See Android Studio & AGP compatibility options", which shows a table with AS and plugin versions. So the solution is to update to a specific version of AS or downgrade to a plugin version that the studio supports. Or using gradle via command line...Truesdale
T
105

Try either to upgrade Android Studio or change AGP version to the stable version like for example 7.2.1 in the project's build.gradle file and sync the project:

buildscript {
    //...
    dependencies {
        classpath 'com.android.tools.build:gradle:7.2.1'

        // ...
    }
}

You can refer to this table, that lists which version of Gradle is required for each version of the Android Gradle plugin.

Or this table that lists which version of the Android Gradle plugin is required for each version of Android Studio.

Trillby answered 25/5, 2022 at 17:50 Comment(4)
Check out Fahime's answer. While the accepted answer works, it is potentially problematic. A full upgrade, as Fahime recommends, might not be the best choice for your case, but there might be some middle ground that can work for you. Thanks to Sergio for a solution that also works.Wreckful
I'm already using com.android.tools.build:gradle:7.2.1 and I still get the errorCohune
@Cohune try to upgrade Android Studio.Trillby
@Trillby I'm already on the latest versionCohune
A
54

Instead of downgrading your AGP version in the accepted answer, you can update your android studio.

Aguish answered 27/9, 2022 at 20:17 Comment(0)
S
30

go to File > Settings and Update Android Studio

file menu update

Suhail answered 18/10, 2022 at 14:58 Comment(1)
Help > Check for updates...Bard
P
16

Update to the latest version of Android Studio i.e. Dolphin and your problem will be resolved

Proverbial answered 13/10, 2022 at 11:0 Comment(4)
The same here with me.Thimbleweed
In my case it's not a good variant because a project compiles in Chipmunk and doesn't compile in Dolphin.Bard
Upgraded to Dolphin and still getting the errorCohune
Thanks. Android Studio gives a link, "See Android Studio & AGP compatibility options", which shows a table with AS and plugin versions. So the solution is to update to a specific version of AS or downgrade to a plugin version that the studio supports. Or using gradle via command line...Truesdale
L
10
plugins {
    id 'com.android.application' version '7.2.2' apply false
    id 'com.android.library' version '7.2.2' apply false
    id 'org.jetbrains.kotlin.android' version '1.7.10' apply false
}

In plugins change the version according to other projects use in your android studio check that and change according to them it will work.

Lassie answered 12/12, 2022 at 13:23 Comment(1)
i tried it from developers site but did'nt work ..and trying it from seeing other Android projects and it worked thanks... : )Theatre
B
5

My answer is going to help someone who was tired of new buggy Android Studio releases and decided to go back to a previous version of Android Studio but came into conflict with the new version of AGP (Android Gradle Plugin) being incompatible with the older version of Android Studio that you chose to use.

I rejected "Jellyfish" to opt for "Hedgehog", my current AGP version is 8.4.0, but Hedgehog's latest supported version is 8.2.2, as it says in the 'Build' tab:

The project is using an incompatible version (AGP 8.4.0) of the Android Gradle plugin. Latest supported version is AGP 8.2.2`

Follow these steps:

  1. Open your project's build.gradle file. You'll see something like this:enter image description here
  2. See line 3 on my screenshot. Navigate to 'Declaration or Usages' of androidApplication by clicking on it with right mouse button → Go To → Declaration or Usages.
  3. You'll appear in the file libs.versions.toml. Find the line with the attribute agp and set it to the version number appropriate for your case (in the 'Build' tab, it suggested I use version 8.2.2, so I changed it from 8.4.0 to 8.2.2).enter image description here
  4. Press "Try again" to initiate a gradle build. Success!
Basil answered 2/5 at 12:6 Comment(0)
P
2
buildscript {
ext.kotlinVersion = '1.6.10'
ext.navigationVersion = '2.4.2'
ext.ktlintVersion = '0.44.0'
ext.hiltVersion = '2.42'

repositories {
    google()
    mavenCentral()
}
dependencies {
    classpath 'com.android.tools.build:gradle:7.2.1'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
    classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$navigationVersion"
    classpath "com.google.dagger:hilt-android-gradle-plugin:$hiltVersion"

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
} 

Setting the versions in the top-level build.gradle as seen above, worked for me.

It is important to change the kotlinVersion as well!

Postgraduate answered 9/7, 2022 at 16:49 Comment(0)
T
2

Update your Android Studio to the latest Android Studio (Dolphin version) version.

Trinitrobenzene answered 24/12, 2022 at 15:58 Comment(0)
D
2

dependencies { classpath 'com.android.tools.build:gradle:7.3.1' }

In the project grade file just change this from 7.4.2 or other newer version to whatever version you want.. Just sync the gradle file. And BOOM ... it will work ... Try again install it.

Doublepark answered 6/5, 2023 at 16:16 Comment(0)
P
2

In Help -> Check for updates you can find it:

enter image description here

Pictish answered 31/8, 2023 at 8:44 Comment(0)
A
2

I also got this error when i updated android studio the error is gone and all things are working proper, So You Just Update Your Android Studio. In Mac keyboard cmd + , press -> Apprearance & Behaviour -> System Settings -> Updates -> Check for Updates -> Update Now

Arv answered 26/3 at 11:11 Comment(0)
D
2

If you're using Gradle Kotlin DSL you can specify versions like you usually could:

alias(libs.plugins.android.application) version("8.3.1")

or

id("com.android.application") version("8.3.1")

No need to edit any toml files.

Discretionary answered 11/4 at 20:49 Comment(0)
S
1

Solution worked for above issue for me :

while using KMP I was prompted to upgrade my AGP to version 8.3.0, after which I started getting the exact same error as the author of this post. I was able to resolve this issue, to do so follow the following steps:

  1. switch to the "Project" foreground instead of Android screenshot
  2. Navigate to the gradle directory
  3. Edit the "libs.versions.toml" file by changing the value of the "agp" variable to the one you want, in my case 8.2.0. screenshot
  4. Sync gradle project.
Soggy answered 18/3 at 8:48 Comment(0)
B
0

check your android studio version, here is corresponding table.

enter image description here

Bothersome answered 30/6, 2023 at 2:17 Comment(0)
B
0

Update your AGP here in latest Android Studio

enter image description here

Bubaline answered 10/6 at 7:2 Comment(0)
P
-1

Just uninstall your existing Android studio and Install a fresh latest available official version and this will work without any errors.

Polyp answered 17/6 at 12:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.