Agent Skillsandroid/skills › agp-9-upgrade

agp-9-upgrade

GitHub

用于将 Android 项目迁移至 AGP 9 版本,涵盖依赖更新、Kotlin 内置支持、新 DSL 及 KSP/kapt 迁移等步骤。

build-system/agp/agp-9-upgrade/SKILL.md android/skills

Trigger Scenarios

用户请求升级或迁移 Android 项目的 AGP 到 9 版本 检测到项目需要适配 Android Gradle Plugin 9.0

Install

npx skills add android/skills --skill agp-9-upgrade -g -y
More Options

Non-standard path

npx skills add https://github.com/android/skills/tree/main/build-system/agp/agp-9-upgrade -g -y

Use without installing

npx skills use android/skills@agp-9-upgrade

指定 Agent (Claude Code)

npx skills add android/skills --skill agp-9-upgrade -a claude-code -g -y

安装 repo 全部 skill

npx skills add android/skills --all -g -y

预览 repo 内 skill

npx skills add android/skills --list

SKILL.md

Frontmatter
{
    "name": "agp-9-upgrade",
    "license": "Complete terms in LICENSE.txt",
    "metadata": {
        "author": "Google LLC",
        "keywords": [
            "Android Gradle Plugin 9",
            "AGP 9",
            "AGP Upgrade",
            "AGP Migration",
            "New AGP DSL",
            "Migrate to built-in Kotlin"
        ],
        "last-updated": "2026-08-18"
    },
    "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."
}

Migration guide

See the AGP 9 migration guide 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 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 for detailed information.

Step 3. Migrate to the new AGP DSL

See the guide for detailed information.

See also gradle-recipes 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 for detailed migration steps.

Step 5. BuildConfig

If any Android module contains custom BuildConfig fields, see BuildConfig 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 for details.

Version History

  • aaca635 Current 2026-08-27 20:07
  • 6685cac 2026-08-19 22:25

Same Skill Collection

camera/camerax/SKILL.md
device-ai/appfunctions/SKILL.md
devtools/android-cli/SKILL.md
identity/restore-credentials/SKILL.md
identity/verified-email/SKILL.md
jetpack-compose/migration/migrate-xml-views-to-jetpack-compose/SKILL.md
jetpack-compose/theming/styles/SKILL.md
media/media3-cast-integration/SKILL.md
navigation/navigation-3/SKILL.md
performance/r8-analyzer/SKILL.md
play/engage-sdk-integration/SKILL.md
play/play-billing-library-version-upgrade/SKILL.md
play/play-policy-insights/SKILL.md
profilers/android-profiler/SKILL.md
profilers/perfetto-sql/SKILL.md
profilers/perfetto-trace-analysis/SKILL.md
security/android-intent-security/SKILL.md
system/edge-to-edge/SKILL.md
testing/testing-setup/SKILL.md
wear/wear-compose-m3/SKILL.md
xr/display-glasses-with-jetpack-compose-glimmer/SKILL.md
jetpack-compose/adaptive/SKILL.md
tv/leanback-to-compose-tv-migration/SKILL.md

Metadata

Files
0
Version
ea05a53
Hash
b24e772c
Indexed
2026-08-19 22:25

trang chủ - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-02 06:42
浙ICP备14020137号-1 $bản đồ khách truy cập$