本文へスキップ
Skillpedia
モバイルアプリ10k · #11907

agp-9-upgrade

できること

このスキルは、Androidプロジェクトを Android Gradle Plugin バージョン9に移行し、それに必要な依存関係を更新します。アップグレードを行うAndroid開発者向けです。Kotlin Multiplatformのプロジェクトは対象外です。

使う場面

  • ✓Androidプロジェクトがまだ古いAndroid Gradle Pluginを使っていて、バージョン9に移行したいとき。
  • ✓Android Gradle Plugin 9へのアップグレードでビルドが壊れ、移行の手順が必要なとき。
  • ✓KSPやHiltを、Android Gradle Plugin 9で動くバージョンに更新したいとき。

スキルのリンク

https://github.com/android/skills/blob/main/build-system/agp/agp-9-upgrade/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/android/skills/blob/main/build-system/agp/agp-9-upgrade/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“AndroidプロジェクトをAndroid Gradle Plugin 9にアップグレードし、壊れた箇所を直してください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

このスキルは、まず現在のプラグインのバージョンを確認します。9より古い場合は、その手順を省略するよう指示しない限り、Android StudioのUpgrade Assistantを実行するよう求めます。その後、移行ガイドに従います。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

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.

よくある質問

先にUpgrade Assistantを実行する必要がありますか?

プロジェクトがバージョン9より前の場合、その手順を省略するよう指示しない限り、実行するよう求められます。

Kotlin Multiplatformのプロジェクトでも使えますか?

いいえ。それらのプロジェクトはこのスキルの対象外です。

ほかに更新が必要なツールはありますか?

KSPやHiltなど、最低バージョンが必要なツールがあり、このスキルがそれらを更新します。

詳細

作者による元の説明

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.

repo: android/skills

人気

GitHubのスター
10k
ランキング
#11907
ライセンス
Apache-2.0
更新日
2026/10/29

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル