Akzhan
Akzhan

Reputation: 483

Failed to upgrade AGP version

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?

Upvotes: 34

Views: 66462

Answers (5)

user12034036
user12034036

Reputation: 11

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.

Upvotes: 1

Dmitry Sergienko
Dmitry Sergienko

Reputation: 125

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

Upvotes: 1

Dmytro Puzak
Dmytro Puzak

Reputation: 1511

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.

Upvotes: 9

qki
qki

Reputation: 1929

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

Upvotes: 36

Hunter Yavitz
Hunter Yavitz

Reputation: 5

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.

Upvotes: 0

Related Questions