Failed to upgrade AGP version
Asked Answered
B

5

32

I cannot update my project. When I try to do this I got this message

The Upgrade Assistant failed to upgrade this project, finding no way of performing the Upgrade AGP version from 4.1.3 to 4.2.0 command, possibly because the project's build files use features not currently supported by the Upgrade Assistant (for example: using constants defined in buildSrc, or other unrecognized constructs, in Gradle build files).

What can i do about it?

Belldas answered 12/5, 2021 at 3:36 Comment(0)
T
35

You have to manually change the gradle versions in build.gradle.kts (project) and then in gradle-wrapper.properties to version that matches your build.gradle.kts version

For example

build.gradle.kts
"com.android.tools.build:gradle:7.0.0-alpha14"

gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-all.zip

Naturally, change the versions accordingly to what you're using

Tachycardia answered 12/5, 2021 at 6:23 Comment(1)
what is path of build.gradle.kts? kindly suggest. Thanks.Prowel
D
9

I had this happen because the Gradle plugin dependency declaration was in a separate variable. After moving the declaration back, directly to build.gradle as:

buildscript {
    ...
    dependencies {
        classpath 'com.android.tools.build:gradle:$your_version'
    ...
    }
}

The error disappeared and Upgrade Assistant started working normally.

Dislocation answered 13/4, 2022 at 14:54 Comment(0)
G
1

I just changed the Android Plugin Version to fix this issue. I was using Version 3.0.2 and I moved to Version 7.0.0. I am happy to tell you this.

Guenevere answered 9/8, 2021 at 16:48 Comment(0)
A
1

In my case I have change the Gradle JDK version 1.8 -> 11 It fix the issue.

Atlante answered 1/3, 2023 at 7:50 Comment(0)
F
0

This happened when I upgraded Android Studio to Canary without uninstalling my previous version. Many issues were resolved when I pointed all IDEs to the same location of JDK.

Flaxman answered 27/7, 2021 at 18:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.