agp-9-upgrade
Skill này làm gì
Skill này chuyển một dự án Android sang Android Gradle Plugin phiên bản 9 và cập nhật các phụ thuộc cần thiết. Nó dành cho lập trình viên Android đang thực hiện việc nâng cấp. Nó không bao quát các dự án Kotlin Multiplatform.
Khi nào nên dùng
- ✓Khi dự án Android của bạn vẫn dùng Android Gradle Plugin cũ và bạn muốn chuyển lên phiên bản 9.
- ✓Khi việc nâng cấp Android Gradle Plugin 9 làm hỏng bản build và bạn cần các bước di chuyển.
- ✓Khi bạn muốn cập nhật KSP hoặc Hilt lên các phiên bản tương thích với Android Gradle Plugin 9.
Liên kết skill
https://github.com/android/skills/blob/main/build-system/agp/agp-9-upgrade/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Nâng cấp dự án Android của tôi lên Android Gradle Plugin 9 và sửa những gì bị lỗi.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Skill kiểm tra trước phiên bản plugin hiện tại. Nếu nó thấp hơn 9, skill yêu cầu bạn chạy Upgrade Assistant trong Android Studio, trừ khi bạn bảo nó bỏ qua bước đó. Sau đó nó làm theo hướng dẫn di chuyển.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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:
- android.builtInKotlin
- android.newDsl
- android.uniquePackageNames
- 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=falsetogradle.properties. - When verifying changes, don't run the
cleantask. This is a waste of time.
Verification
After migration, verify the following:
- Gradle IDE sync succeeds.
./gradlew helpsucceeds../gradlew build --dry-runsucceeds.
Troubleshooting
Paparazzi v2.0.0-alpha04 and lower versions have issues with AGP 9. See references/paparazzi-gradle-9.md for details.
Câu hỏi thường gặp
Tôi có cần chạy Upgrade Assistant trước không?
Skill yêu cầu bạn chạy nó nếu dự án đang dùng phiên bản thấp hơn 9, trừ khi bạn bảo nó bỏ qua bước này.
Nó có hoạt động với các dự án Kotlin Multiplatform không?
Không. Skill này không hỗ trợ các dự án đó.
Những công cụ nào khác cần cập nhật?
Một số công cụ, chẳng hạn KSP và Hilt, cần phiên bản tối thiểu, và skill sẽ cập nhật chúng.
Chi tiết
Mô tả gốc của tác giả
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
Độ phổ biến
- Sao GitHub
- 10k
- Vị trí xếp hạng
- #11907
- Giấy phép
- Apache-2.0
- Cập nhật
- 29/10/2026
Bình luận
- …
Thêm skill từ kho mã này
camerax
10kGiúp agent của bạn xây dựng các tính năng camera Android bằng CameraX, gồm quay video, điều khiển phần cứng, ML Kit và hiệu ứng Media3.
android-for-cars-parked-apps
10kĐiều chỉnh một ứng dụng video, trò chơi hoặc trình duyệt Android để chạy như ứng dụng khi xe đỗ trên Android Auto và Android Automotive.
appfunctions
10kTìm các luồng công việc chính trong ứng dụng Android và công khai chúng dưới dạng AppFunctions để agent AI và lệnh giọng nói có thể chạy.
litert-lm
10kGiúp agent của bạn xây dựng một ứng dụng Android chạy mô hình AI văn bản mở ngay trên thiết bị, dùng API Kotlin của LiteRT-LM.
Skill tương tự
android-clean-architecture
280kGiúp agent của bạn tổ chức dự án Android hiệu quả, cấu trúc code để việc bảo trì và phát triển tính năng mới dễ dàng hơn.
compose-multiplatform-patterns
280kGiúp agent của bạn dùng các mẫu Compose Multiplatform và Jetpack Compose trong dự án KMP, gồm trạng thái, điều hướng, giao diện và hiệu năng.
dart-flutter-patterns
280kGiúp agent của bạn viết code cho ứng dụng Dart và Flutter. Agent dùng các mẫu hiện đại để tạo ứng dụng vững chắc và dễ quản lý.