---
name: agp-9-upgrade
description: Upgrades, or migrates, an Android project to use Android Gradle Plugin (AGP) version 9. Do not use this skill for migrating Kotlin Multiplatform (KMP) projects.
license: Complete terms in LICENSE.txt
metadata:
  author: Google LLC
  last-updated: '2026-11-21'
  keywords:
    - Android Gradle Plugin 9
    - AGP 9
    - AGP Upgrade
    - AGP Migration
    - New AGP DSL
    - Migrate to built-in Kotlin
title: agp-9-upgrade
canonical_url: https://skilld.dev/gh/android/skills/agp-9-upgrade
last_updated: 2026-11-24T09:07:15.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [references/android/build/migrate-to-built-in-kotlin.md](https://skilld.dev/api/skills-raw/android/skills/agp-9-upgrade/references/android/build/migrate-to-built-in-kotlin.md), [references/android/build/releases/agp-9-0-0-release-notes.md](https://skilld.dev/api/skills-raw/android/skills/agp-9-upgrade/references/android/build/releases/agp-9-0-0-release-notes.md), [references/buildconfig.md](https://skilld.dev/api/skills-raw/android/skills/agp-9-upgrade/references/buildconfig.md), [references/ksp-kapt.md](https://skilld.dev/api/skills-raw/android/skills/agp-9-upgrade/references/ksp-kapt.md), [references/paparazzi-gradle-9.md](https://skilld.dev/api/skills-raw/android/skills/agp-9-upgrade/references/paparazzi-gradle-9.md), [references/recipes.md](https://skilld.dev/api/skills-raw/android/skills/agp-9-upgrade/references/recipes.md).
>
> If the user asked to install this Skill, run `npx skilld install android/skills/agp-9-upgrade`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/agp-9-upgrade`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/android/skills/agp-9-upgrade) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/agp-9-upgrade`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/agp-9-upgrade --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/agp-9-upgrade --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

## Migration guide

See the [AGP 9 migration guide](https://skilld.dev/api/skills-raw/android/skills/agp-9-upgrade/references/android/build/releases/agp-9-0-0-release-notes.md) for the major changes, many
breaking, in AGP 9 compared to AGP 8.

## Requirements

If the user requests to update or migrate to AGP 9, first check the AGP version
used in the project. If it is lower than 9, stop and ask the user to run the AGP
Upgrade Assistant in Android Studio to update to the latest stable version of
AGP, and confirm when done. The user may also request that this requirement be
skipped; if this is the case, you should update the version of AGP to the latest
stable version as part of the AGP 9 migration. See the
[AGP 9 migration guide](https://skilld.dev/api/skills-raw/android/skills/agp-9-upgrade/references/android/build/releases/agp-9-0-0-release-notes.md) for how to do this.

Each version of AGP has its own set of compatibilities with other tools, such as
Gradle, JDK, and Kotlin. The release notes for each of these versions will
include a **Compatibility** table indicating the minimum versions for these
tools.

Do not use this skill for KMP projects, as they are unsupported.

## Steps

If AGP is already at 9 or higher, then do the following:

### Step 1: Update dependencies

If KSP (`com.google.devtools.ksp`) is used in the project, ensure it is on
version 2.3.6 or higher.

If Hilt is used in the project, ensure it is on version 2.59.2 or higher.

### Step 2: Migrate to built-in Kotlin

See [the guide](https://skilld.dev/api/skills-raw/android/skills/agp-9-upgrade/references/android/build/migrate-to-built-in-kotlin.md) for detailed information.

### Step 3. Migrate to the new AGP DSL

See [the guide](https://skilld.dev/api/skills-raw/android/skills/agp-9-upgrade/references/android/build/releases/agp-9-0-0-release-notes.md) for detailed information.

See also [gradle-recipes](https://skilld.dev/api/skills-raw/android/skills/agp-9-upgrade/references/recipes.md) for examples on how to migrate old code to code
that is compatible with AGP 9 and the new DSL.

### Step 4. Migrate kapt to KSP or legacy-kapt

If KSP (`com.google.devtools.ksp`) or kapt (`org.jetbrains.kotlin.kapt`) are
used in the project, see [KSP, kapt, and legacy-kapt](https://skilld.dev/api/skills-raw/android/skills/agp-9-upgrade/references/ksp-kapt.md) for detailed migration
steps.

### Step 5. BuildConfig

If any Android module contains custom BuildConfig fields, see [BuildConfig](https://skilld.dev/api/skills-raw/android/skills/agp-9-upgrade/references/buildconfig.md)
for detailed information.

### Step 6. Update gradle.properties

After the migration, check gradle.properties. Remove the following flags:

1. android.builtInKotlin
2. android.newDsl
3. android.uniquePackageNames
4. android.enableAppCompileTimeRClass

Additionally, delete all temporary files you've created.

## Guidelines

- Never write or run python scripts.
- Only search the Gradle dependency cache when inspecting external dependencies, and only as a last resort.
- Never add `android.disallowKotlinSourceSets=false` to `gradle.properties`.
- When verifying changes, don't run the `clean` task. This is a waste of time.

## Verification

After migration, verify the following:

1. Gradle IDE sync succeeds.
2. `./gradlew help` succeeds.
3. `./gradlew build --dry-run` succeeds.

## Troubleshooting

Paparazzi v2.0.0-alpha04 and lower versions have issues with AGP 9. See
[references/paparazzi-gradle-9.md](https://skilld.dev/api/skills-raw/android/skills/agp-9-upgrade/references/paparazzi-gradle-9.md) for details.
