news 2026/11/5 16:49:45

Google发布Andorid官方SKILL

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
Google发布Andorid官方SKILL

什么是skill

AI Coding时代skill可以提升开发体验,skill是可复用提示词,帮助AI大模型理解当前工程的注意点

官网链接

https://github.com/android/skills

例:升级AGP9和迁移compose

SKILL.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 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.## VerificationAfter migration, verify the following:1. Gradle IDEsyncsucceeds.2.`./gradlewhelp`succeeds.3.`./gradlew build --dry-run`succeeds.## 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 View's 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 compilerCheck`build.gradle`or`libs.versions.toml`forCompose 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

版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/10/21 9:59:10

HTTP缓存机制详解:强缓存与协商缓存实战指南

1. 缓存机制基础认知浏览器缓存就像我们日常生活中的备忘录系统。想象你是一名忙碌的行政助理,每天要处理大量重复性咨询。当有人第一次询问"公司会议室使用规定"时,你需要花10分钟查阅手册并回复。如果每次同样的问题都重新查手册&#xff0c…

作者头像 李华
网站建设 2026/10/24 14:01:38

10MW/20MWh储能项目技术方案:从容量配置到并网调试的完整落地路径

简介:这份PDF技术方案面向储能电站设计人员、新能源项目工程师及电力系统相关专业学习者,围绕10MW/20MWh磷酸铁锂储能项目展开,解决大规模电能存储与供应场景下的系统选型、架构设计与安全防护问题。方案以10套1MW/2MWh储能系统为基本单元&am…

作者头像 李华
网站建设 2026/10/24 20:28:04

粒子生命模拟入门:用规则矩阵与力场打造涌现式人工生命

/* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views …

作者头像 李华
网站建设 2026/10/23 23:42:49

【单片机毕业设计】基于STM32的婴儿摇篮环境监测与云平台图像监控装置设计 基于物联网的智能婴儿床哭泣尿床监测与云端联动系统设计(032708)

博主介绍:✌️码农一枚 ,专注于大学生项目实战开发、讲解和毕业🚢文撰写修改等。全栈领域优质创作者,博客之星、掘金/华为云/阿里云/InfoQ等平台优质作者、专注于嵌入式单片机,Java、小程序技术领域和毕业项目实战 ✌️…

作者头像 李华
网站建设 2026/10/24 16:59:29

LLM_端到端自动驾驶

EAI:Embodied Artificial Intelligent,E2E:End to End,LLM:Large Language Mode 端到端自动驾驶专题:多模态输入融合、开源框架、头部企业与性能对比核心定义:端到端自动驾驶分为两类 纯端到端&…

作者头像 李华