Google发布Andorid官方SKILL

发布时间:2026/10/14 2:40:44

Google发布Andorid官方SKILL 什么是skillAI Coding时代skill可以提升开发体验skill是可复用提示词帮助AI大模型理解当前工程的注意点官网链接https://github.com/android/skills例升级AGP9和迁移composeSKILL.md--- name: agp-9-upgrade description: Upgrades, or migrates, an Android project to use Android Gradle Plugin(AGP)version9. Do not use this skillformigrating Kotlin Multiplatform(KMP)projects. license: Complete termsinLICENSE.txt metadata: author: Google LLC keywords: - Android Gradle Plugin9- AGP9- AGP Upgrade - AGP Migration - New AGP DSL - Migrate to built-in Kotlin ---## Migration guideSee the[AGP9migration guide](references/android/build/releases/agp-9-0-0-release-notes.md)forthe major changes, many breaking,inAGP9compared to AGP8.## RequirementsIf the user requests to update or migrate to AGP9, first check the AGP version usedinthe project. If it is lower than9, stop and ask the user to run the AGP Upgrade AssistantinAndroid Studio to update to the latest stable version of AGP, and confirm when done. The user may also request that this requirement be skipped;ifthis is the case, you should update the version of AGP to the latest stable version as part of the AGP9migration. See the[AGP9migration guide](references/android/build/releases/agp-9-0-0-release-notes.md)forhow todothis. Each version of AGP has its ownsetof compatibilities with other tools, such as Gradle, JDK, and Kotlin. The release notesforeach of these versions will include a **Compatibility** table indicating the minimum versionsforthese tools. Do not use this skillforKMP projects, as they are unsupported.## StepsIf AGP is already at9or higher,thendothe following:### Step 1: Update dependenciesIf KSP(com.google.devtools.ksp)is usedinthe project, ensure it is on version2.3.6 or higher. If Hilt is usedinthe project, ensure it is on version2.59.2 or higher.### Step 2: Migrate to built-in KotlinSee[the guide](references/android/build/migrate-to-built-in-kotlin.md)fordetailed information.### Step 3. Migrate to the new AGP DSLSee[the guide](references/android/build/releases/agp-9-0-0-release-notes.md)fordetailed information. See also[gradle-recipes](references/recipes.md)forexamples on how to migrate old code to code that is compatible with AGP9and the new DSL.### Step 4. Migrate kapt to KSP or legacy-kaptIf KSP(com.google.devtools.ksp)or kapt(org.jetbrains.kotlin.kapt)are usedinthe project, see[KSP, kapt, and legacy-kapt](references/ksp-kapt.md)fordetailed migration steps.### Step 5. BuildConfigIf any Android module contains custom BuildConfig fields, see[BuildConfig](references/buildconfig.md)fordetailed information.### Step 6. Update gradle.propertiesAfter the migration, check gradle.properties. Remove the following flags:1. android.builtInKotlin2. android.newDsl3. android.uniquePackageNames4. android.enableAppCompileTimeRClass Additionally, delete all temporary files youve 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.disallowKotlinSourceSetsfalse to gradle.properties. - When verifying changes, dont run thecleantask. This is a waste of time.## VerificationAfter migration, verify the following:1. Gradle IDEsyncsucceeds.2../gradlewhelpsucceeds.3../gradlew build --dry-runsucceeds.## TroubleshootingPaparazzi v2.0.0-alpha04 and lower versions have issues with AGP9. See[references/paparazzi-gradle-9.md](references/paparazzi-gradle-9.md)fordetails.--- name: migrate-xml-views-to-jetpack-compose description: Provides a structured workflowformigrating an Android XML View to Jetpack Compose. This skill details the step-by-step process, from planning and dependency setup, to theming and layout migration, validation and XML cleanup. Use this skill when you need to migrate an XML View to Jetpack Composeinan Android project. It solves the problem of converting the UI of a legacy XML View into modern, declarative Compose componentswhilemaintaining interoperability. license: Complete termsinLICENSE.txt metadata: author: Google LLC keywords: - Jetpack Compose - migration - XML - Views - interoperability - incremental adoption - UI development --- This skill guides through the process of migrating an existing Android XML View to Jetpack Compose. It performs a stable, safe and visually consistent transition by following a structured,10-step methodology. This skill migrates UI(XML to Jetpack Compose)only.## ObjectiveTo systematically convert a single legacy XML layout into modern, declarative Jetpack Compose UIwhilemaintaining pixel-perfect visual parity and functional integrity.## Summary of the 10-step migration process1. **Identify the optimal XML candidateformigration**2. **Analyze the project and layout**3. **Create a plan**4. **Capture the XML View UI**5. **Set up Compose dependencies and compiler**6. **Set up Compose theming**7. **Migrate the XML layout to Compose**8. **Validate the migration**9. **Replace usages**10. **XML code removal**## Detailed steps### Step 1: Identify the optimal XML candidate for migrationIf the user has explicitly specified a target XML layout, proceed to Step2. Otherwise, analyze the codebase to identify the best candidateformigration by following the logicin[references/identify-optimal-xml-candidate.md](references/identify-optimal-xml-candidate.md).### Step 2: Analyze the project and layoutAnalyze the identified XML Views structure, hierarchy, and implementation details. Use[references/analysis-of-the-project-and-layout.md](references/analysis-of-the-project-and-layout.md)to guide your technical audit of the layout and surrounding project context.### Step 3: Create a planUsing the outputs and analysisdoneinthe Step1and2, generate a step-by-step planforthe migration. If you support user interaction, present to the user and askforapproval before proceeding. If user interaction is not supported, proceed to Step4following the generated plan.### Step 4: Capture the XML View UI**IF** you support user interaction, ask the user to upload a screenshot of the XML View UI or provide an absolute path to a file. Use this image as a visual referenceforthe layout migrationinStep7. **ELSE IF** you are able to run an Android emulator,locatean existing screenshottestforthe XML candidate. If none exists, create one using the existing project testing framework. If no framework exists, use **UI Automator** or **Espresso** to create a screenshottestwith minimum required setup. Run thetestand take a baseline screenshot of the XML UI. **ELSE** proceed to Step5.### Step 5: Set up Compose dependencies and compilerCheckbuild.gradleorlibs.versions.tomlforCompose dependencies and compiler setup. If missing, use[Setup Compose Dependencies and Compiler](references/android/develop/ui/compose/setup-compose-dependencies-and-compiler.md). Run asyncto ensure dependencies resolve without errors.### Step 6: Set up Compose themingIf the project already has Compose themingsetup, proceed to Step7. If Compose theming is missing, initialize it. For Material-based projects, follow[Material3migration guidelines](references/android/develop/ui/compose/designsystems/migrate-xml-theme-to-compose.md). For custom design systems, apply expert judgment to migrate XML theming and match existing styles. **Constraints:** Do not migrate the entire theme. Implement only the minimum theming requiredforthe specific XML candidate. Maintain original XML themesforinteroperability. Maintain existing project code conventions, patterns, names and values.### Step 7: Migrate the XML View to ComposeConvert the XML candidate to Jetpack Compose code, referencing[references/xml-layout-migration.md](references/xml-layout-migration.md)and the image from Step4. You must include a **Compose Preview**forthe newly created composable to facilitate visual verification.### Step 8: Replace usagesReplace the usages of the migrated XML layout to use the new Compose component. - ToaddComposeinViews, use[ComposeinViews](references/android/develop/ui/compose/migrate/interoperability-apis/compose-in-views.md). - ToaddViewsinCompose, use[ViewsinCompose](references/android/develop/ui/compose/migrate/interoperability-apis/views-in-compose.md).### Step 9: Validate the migrationCompare the baseline screenshot image from Step4with the rendered Compose Preview of the new composable. Ignore string content;focus on layout and styling. Iterate on the Compose codeuntilvisual parity is achieved. Once verified,writea Compose UItestforthe new composable.### Step 10: XML code removalDelete the migrated XMLfileand its associated legacy tests. **Caution:** Only remove code and resources that are not referenced by other parts of the project.ref:https://mp.weixin.qq.com/s/TEyjsoYktfvFQJzwfedPAw
延伸阅读

更多相关文章

2026/10/14 2:40:44

MATLAB车辆制动仿真与盘式制动器优化:从I曲线到fmincon

简介:这是一份基于MATLAB的车辆制动性仿真研究课程设计成果,面向车辆工程专业学生及制动系统开发工程师,帮助读者系统掌握利用Simulink与优化算法开展制动性能建模和分析的方法。内容以BJ1041货车参数为输入,涵盖车辆质量、轴距、…

2026/10/14 4:45:50

LLM Agent可观测性实战:Tracing、Evals与成本追踪一体化落地

1. 这不是“又一个AI监控工具”,而是LLM应用落地的生存指南你有没有遇到过这样的情况:模型在测试环境里回答得头头是道,一上线就频繁“胡言乱语”;用户投诉说“昨天还能正常用,今天突然卡住半天没反应”;运…

2026/10/14 4:45:50

垂直行业AI Agent如何变现:外贸一体化智能工作台实战构想

通用AI Agent喊了这么久,真正靠它赚到钱的团队其实没多少。套壳聊天、通用写作、泛泛的助理——这些场景听着热闹,一谈付费就沉默,客户试完就溜,续费更是奢望。我自己看过不少团队在这上面耗了大半年,最后连服务器成本…

2026/10/14 4:45:50

分布式存储系统设计全解析:从架构选型到副本一致性

分布式存储系统设计,这六个字背后往往是硬盘爆满、数据迁移时凌晨两三点的折腾,以及“为什么我不能像用本地磁盘一样流畅地用一个集群”的灵魂拷问。我要写的,是某公司内部一套分布式存储系统的完整设计过程,从需求拆解、架构选型…

2026/10/14 4:45:50

计算机考研复试数据结构面试高频题与备考策略

1. 复试面试的真实面貌与备考逻辑1.1 为什么数据结构是复试面试的“必争之地”聊到计算机与软件工程方向的研究生复试,数据结构几乎是绕不开的一道坎。不管是现场抽题、导师随机提问,还是上机测试,数据结构都占据着相当大的比重。我带过几届考…

2026/10/14 4:45:50

一文搞懂MySQL socket连接:原理、配置与2002/2003故障排查

一次线上事故让我把socket连接这件事彻底搞明白了。当时某个项目组反馈所有本地应用突然连不上MySQL,我登录服务器一看,mysqld进程明明活着,3306端口也在正常监听,可本地应用全部报socket错误。查了半个多小时,最后发现…

2026/10/14 4:40:50

SAP CPI iFlow入站接口OAuth 2.0 Client Credentials认证配置与排障指南

这阵子处理一组跨系统集成的需求时,正好碰到一个非常典型的场景:外部系统需要主动调用我们暴露在 SAP Cloud Integration(日常还是习惯叫 CPI)上的 iFlow 接口,对方运维明确说不能给共享账号密码,也不想互相…

2026/10/13 5:19:27

Python调用Gemini Structured Outputs实现工单路由门禁

客服工单最怕的不是模型“答错一句话”,而是它给出一段看起来合理的说明,程序却从中猜错优先级。通俗做法是:要求模型只交 JSON(JavaScript Object Notation,轻量数据格式),再让代码验证它。Gem…

2026/10/13 17:09:18

Spring Boot超市进销存系统毕设实战:从需求拆解到答辩通关

最近带的一个学生项目组里,有A同学跑来问我:选什么毕设题目最稳妥,既能让评审老师觉得工作量够,又不会在答辩时被问到语无伦次。我第一反应就是推荐基于Spring Boot的超市仓库管理系统——也就是超市进销存系统。这个题目乍一看平…

2026/10/14 2:32:55

Flutter StatefulWidget 生命周期核心解析

很多刚开始接触 Flutter 的朋友,在看完一堆“Hello World”和基础组件之后,大概率都会撞上同一堵墙:StatefulWidget 里那堆 initState、build、dispose 方法,到底什么时候被调用?为什么顺序是那样?在里面到…

2026/10/14 0:00:33

DFS算法解决飞机降落调度问题实战

1. 项目背景与核心思路飞机降落问题是一个经典的调度优化场景,也是算法竞赛和面试中的高频题目。这个题目要求我们合理安排多架飞机的降落顺序和时间,确保所有飞机都能安全着陆而不发生冲突。在实际航空管制中,这类问题直接关系到飞行安全和机…

2026/10/14 0:00:33

macOS/iOS高精度计时:mach_absolute_time原理与实战

1. 项目概述:为什么mach_absolute_time是 macOS/iOS 时间测量的“黄金标准”在 macOS 和 iOS 开发中,我见过太多人用CFAbsoluteTimeGetCurrent()或NSDate.timeIntervalSinceReferenceDate做性能打点,结果在高精度场景下被系统时钟跳变、NTP 同…

2026/10/14 0:00:33

SCORM课件演示与测试全解析:从API通信到自动化验证

简介:这是一套遵循SCORM标准的交互式课件演示与测试资源,面向E-Learning课程开发者、LMS平台测试人员及在线教学从业者,用于验证课件在不同学习管理系统中的识别、传递与跟踪能力。压缩包共28个文件,约12.07MB,以swf动…

还想了解更多?直接咨询顾问

免费诊断 + 免费方案 + 透明报价。

全国咨询热线400-8866-253
免费获取方案
☎咨询二维码 ☎ ↑