Flutter and app store releases · Troubleshooting walkthrough
Android Studio's AGP Upgrade Assistant blocks a step or ends in Sync Failed
Short answer
The Upgrade Assistant failed to upgrade this project when a step is blocked or the build cannot sync afterwards. A blocked step names its reason, often Cannot find AGP version in build files or jcenter before AGP 9. Fix it by hand and rerun; after Sync Failed, press Revert Project Files. Covers Android Studio Rabbit 2, AGP 7.1 to 9.5.
The Upgrade Assistant runs a list of required steps to move a project to a newer Android Gradle plugin (AGP). It stops with failed to upgrade this project when a step is blocked, or when the new build will not sync afterwards. A blocked step says so, with the reason underneath, and each reason points at something you can fix by hand and then retry.
Work through the stages in order: find the blocked step, read its reason, fix that, and if the sync fails after the upgrade, revert and go in smaller hops.
The text you see
The Upgrade Assistant failed to upgrade this project, finding no way of performing the following command:This project is using Android Gradle plugin version 7.0.4, which is incompatible with this version of Android Studio.Cannot find AGP version in build files.jcenter is a deprecated propertySync Failed. The project failed to sync with the IDE.
Stage 1
Stage 1: find the blocked step and where AGP is declared
Open Tools > AGP Upgrade Assistant and click each required step. A blocked step shows This step is blocked with the reason beneath it. Then list every place the build declares the Android Gradle plugin, because two of the causes depend on where that version lives.
Every declaration of the plugin
grep -rn --include=*.gradle --include=*.kts --include=*.toml \
-e "com.android.application" -e "com.android.library" -e "com.android.tools.build:gradle" .| Reason shown | Meaning | Section |
|---|---|---|
| Cannot find AGP version in build files | The assistant cannot read where the version is set | Stage 2 |
| jcenter is a deprecated property | jcenter() in the root buildscript while targeting AGP 9 or newer | Stage 3 |
| Incompatibility between Android Studio and Android Gradle plugin | The project's AGP is older than this Studio can open | Stage 4 |
| Sync Failed after running steps | The new AGP rejects something in the build | Stage 5 |
Stage 2
Stage 2: Cannot find AGP version in build files
The assistant works by static analysis of the build files. It does not follow constants defined in buildSrc, version catalogs declared inside settings files, or catalogs used for anything other than dependencies and plugins. If the files were edited outside the IDE, a fresh sync may already clear the block.
If not, move the version into gradle/libs.versions.toml, apply the plugin by its catalog alias, sync, and open the assistant again.
AGP version in the catalog (use your own version number)
# gradle/libs.versions.toml
[versions]
androidGradlePlugin = "8.13.2"
[plugins]
android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }
// top-level build.gradle.kts
plugins {
alias(libs.plugins.android.application) apply false
}Stage 3
Stage 3: jcenter and a target of AGP 9
For a target of AGP 9.0 or later, the assistant refuses to run while the root build file's buildscript block still calls jcenter(), and it explains that Gradle 9 no longer supports that repository. Picking an 8.x target makes the block disappear, which confirms this is the cause.
Replace jcenter() in every repositories block
buildscript {
repositories {
google()
mavenCentral() // was jcenter()
}
}Sync on the old AGP first. Then, with a 9.x target chosen, the version step should no longer be blocked.
Stage 4
Stage 4: the project's AGP is too old for this Studio
A dialog titled Incompatibility between Android Studio and Android Gradle plugin appears when the project's AGP is outside the range the installed Studio supports. The assistant lists the blocked commands, and each has a reason like the ones above. Clear them by hand first, then let it raise AGP.
For a very old project, upgrade in hops. An older Android Studio whose supported range still includes the current AGP can move it forward first; the Android Studio releases page has the compatibility table.
Which AGP does the project use
grep -rn "com.android.tools.build:gradle" build.gradle* settings.gradle*Stage 5
Stage 5: Sync Failed after the steps ran
Sync Failed with The error message from sync is: and a Revert Project Files button means the edits applied but the new AGP rejects something. That is common on the jump from 8.x to 9.x: the kotlin-android plugin, the old variant API and third-party plugins that still expect the old DSL.
Press Revert Project Files, then go in smaller pieces. For AGP 9, keep the assistant's steps Preserve the old (internal) AGP Dsl APIs and Disable built-in Kotlin support selected until your plugins are ready. They write the two flags below, and the AGP 9.0 release notes say the newDsl opt-out goes away in AGP 10, so plan to remove both.
The temporary opt-outs, and the command to read the real sync error
# gradle.properties, written by the assistant's opt-out steps
android.newDsl=false
android.builtInKotlin=false
./gradlew help --stacktraceStage 6
Confirm and keep the upgrade safe
The assistant should report Sync succeeded. Then build and run the tests before committing. Commit before every assistant run, so a failed sync can be undone from version control as well as from the Revert button.
Build and unit tests after the upgrade
./gradlew assembleDebug testDebugUnitTestIf every step syncs but the final upgrade still fails, the AGP documentation asks for a bug report with the assistant's output.
If you only keep one thing
- Read the reason under the blocked step; it names the fix.
- Keep the AGP version in
gradle/libs.versions.toml. - Both opt-out flags in
gradle.propertiesare short-term; remove them once your plugins catch up.
Sources
- Android Developers: AGP Upgrade Assistant
- Android Developers: AGP 9.0.0 release notes
- Android Studio releases (Studio and AGP compatibility)
- Android Developers: Migrate your build to version catalogs
- Android Studio source: AgpVersionRefactoringProcessor (block reasons)
- Android Studio source: the cannot-upgrade dialog
- Android Studio source: Upgrade Assistant messages
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.