Skip to content

Commit 04d6e21

Browse files
Updates skills (2026-04-27 08:51)
1 parent b281881 commit 04d6e21

59 files changed

Lines changed: 8502 additions & 104 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

build/agp/agp-9-upgrade/SKILL.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
22
name: agp-9-upgrade
33
description: Upgrades, or migrates, an Android project to use Android Gradle Plugin
4-
(AGP) version 9. Do not use this skill for migrating Kotlin Multiplatform (KMP) projects.
4+
(AGP) version 9. Do not use this skill for migrating Kotlin Multiplatform (KMP)
5+
projects.
56
license: Complete terms in LICENSE.txt
67
metadata:
78
author: Google LLC
@@ -27,8 +28,7 @@ Upgrade Assistant in Android Studio to update to the latest stable version of
2728
AGP, and confirm when done. The user may also request that this requirement be
2829
skipped; if this is the case, you should update the version of AGP to the latest
2930
stable version as part of the AGP 9 migration. See the
30-
[AGP 9 migration guide](references/android/build/releases/agp-9-0-0-release-notes.md)
31-
for how to do this.
31+
[AGP 9 migration guide](references/android/build/releases/agp-9-0-0-release-notes.md) for how to do this.
3232

3333
Each version of AGP has its own set of compatibilities with other tools, such as
3434
Gradle, JDK, and Kotlin. The release notes for each of these versions will
@@ -48,11 +48,11 @@ version 2.3.6 or higher.
4848

4949
If Hilt is used in the project, ensure it is on version 2.59.2 or higher.
5050

51-
### Step 2: Migrate to built-in Kotlin.
51+
### Step 2: Migrate to built-in Kotlin
5252

5353
See [the guide](references/android/build/migrate-to-built-in-kotlin.md) for detailed information.
5454

55-
### Step 3. Migrate to the new AGP DSL.
55+
### Step 3. Migrate to the new AGP DSL
5656

5757
See [the guide](references/android/build/releases/agp-9-0-0-release-notes.md) for detailed information.
5858

@@ -62,8 +62,8 @@ that is compatible with AGP 9 and the new DSL.
6262
### Step 4. Migrate kapt to KSP or legacy-kapt
6363

6464
If KSP (`com.google.devtools.ksp`) or kapt (`org.jetbrains.kotlin.kapt`) are
65-
used in the project, [KSP, kapt, and legacy-kapt](references/ksp-kapt.md)
66-
for detailed migration steps.
65+
used in the project, see [KSP, kapt, and legacy-kapt](references/ksp-kapt.md) for detailed migration
66+
steps.
6767

6868
### Step 5. BuildConfig
6969

build/agp/agp-9-upgrade/references/android/build/releases/agp-9-0-0-release-notes.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,17 @@
33
Android Gradle plugin 9.0 is a major release that brings API and behavior
44
changes.
55

6-
To update to Android Gradle plugin 9.0.1,
7-
use the [Android Gradle plugin Upgrade Assistant](https://developer.android.com/build/agp-upgrade-assistant).
8-
9-
The AGP upgrade assistant helps preserve existing behaviors when upgrading your
10-
project whenever appropriate, allowing you to upgrade your project to use AGP
11-
9.0 even if you're not ready to adopt all the new defaults in AGP 9.0.
6+
To update to Android Gradle plugin 9.0.1, use the
7+
[Android Gradle plugin Upgrade Assistant](https://developer.android.com/build/agp-upgrade-assistant). The AGP upgrade assistant helps
8+
preserve existing behaviors when upgrading your project whenever appropriate, so
9+
you can upgrade your project to use AGP 9.0 even if you're not ready to
10+
adopt all the new defaults in AGP 9.0.
11+
12+
There are also two agent skills available to make the upgrade process easier.
13+
For a non-KMP app, try the [AGP 9 upgrade skill](https://github.com/android/skills/tree/main/build/agp/agp-9-upgrade) from the
14+
Android skills repository. For a KMP app, try the [AGP 9 upgrade
15+
skill](https://github.com/Kotlin/kotlin-agent-skills/tree/main/skills/kotlin-tooling-agp9-migration) from JetBrains. For more information about using skills
16+
in Android Studio, see [Extend Agent Mode with skills](https://developer.android.com/studio/gemini/skills).
1217

1318
## Compatibility
1419

build/agp/agp-9-upgrade/references/recipes.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ migrated.
44

55
## Guidelines
66

7-
- **DO NOT** search the web for examples of how to do this. Use the
8-
**gradle-recipes** repository examples **only**.
7+
- **DO NOT** search the web for examples of how to do this. Use the **gradle-recipes** repository examples **only**.
98
- **DO NOT** use AGP internals in migrated code.
109
- **DO** use only public APIs in migrated code.
1110

jetpack-compose/migration/migrate-xml-views-to-jetpack-compose/references/android/develop/ui/compose/migrate/interoperability-apis/compose-in-views.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
> [!NOTE]
2+
> **Note:** Interoperability is supported for hybrid apps that use Compose and Views. For apps that are only in Compose, use the recommended Compose-only architecture with a single Activity and latest navigation libraries, like Navigation 3.
3+
14
You can add Compose-based UI into an existing app that uses a View-based design.
25

36
To create a new, entirely Compose-based screen, have your
@@ -61,7 +64,10 @@ The table below summarizes the different scenarios you can use
6164
| [`DisposeOnLifecycleDestroyed`](https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/ViewCompositionStrategy.DisposeOnLifecycleDestroyed) | The Composition will be disposed when the provided [`Lifecycle`](https://developer.android.com/reference/androidx/lifecycle/Lifecycle) is destroyed. Interop scenario \* `ComposeView` in a Fragment's View. |
6265
| [`DisposeOnViewTreeLifecycleDestroyed`](https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed) | The Composition will be disposed when the `Lifecycle` owned by the `LifecycleOwner` returned by `ViewTreeLifecycleOwner.get` of the next window the View is attached to is destroyed. Interop scenario: \* `ComposeView` in a Fragment's View. \* `ComposeView` in a View wherein the Lifecycle is not known yet. |
6366

64-
## `ComposeView` in Fragments
67+
## `ComposeView` in Fragments (Transitionary Step)
68+
69+
> [!NOTE]
70+
> **Note:** For hybrid apps with Views and Compose, that use Fragments, use `ComposeView` to wrap composables content and add to a Fragment during migration. For Compose-only apps, do not use Fragments and instead use the recommended Compose-only architecture with a single Activity and latest navigation libraries, like Navigation 3.
6571
6672
If you want to incorporate Compose UI content in a fragment or an existing View
6773
layout, use [`ComposeView`](https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/ComposeView)

jetpack-compose/migration/migrate-xml-views-to-jetpack-compose/references/android/develop/ui/compose/migrate/interoperability-apis/views-in-compose.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ Compose, like
44
[`AdView`](https://developers.google.com/android/reference/com/google/android/gms/ads/AdView).
55
This approach also lets you reuse custom views you may have designed.
66

7+
> [!NOTE]
8+
> **Note:** Use `AndroidView` as a wrapper only for missing SDK components without Compose support. Rewrite your custom Views in Compose wherever possible, starting the migration with the simplest custom Views and scaling to more complex ones.
9+
10+
<br />
11+
712
To include a view element or hierarchy, use the [`AndroidView`](https://developer.android.com/reference/kotlin/androidx/compose/ui/viewinterop/AndroidView.composable#AndroidView(kotlin.Function1,androidx.compose.ui.Modifier,kotlin.Function1))
813
composable. `AndroidView` is passed a lambda that returns a
914
[`View`](https://developer.android.com/reference/android/view/View). `AndroidView` also provides an `update`
@@ -63,6 +68,9 @@ To embed an XML layout, use the
6368
API, which is provided by the `androidx.compose.ui:ui-viewbinding` library. To
6469
do this, your project must enable [view binding](https://developer.android.com/topic/libraries/view-binding#setup).
6570

71+
> [!NOTE]
72+
> **Note:** For Compose-only apps, don't use `AndroidViewBinding` to inflate full screen-level XML layouts, and instead use it only for smaller, legacy XML layouts during the incremental migration process.
73+
6674

6775
```kotlin
6876
@Composable
@@ -113,12 +121,15 @@ fun AndroidViewInLazyList() {
113121

114122
<br />
115123

116-
## Fragments in Compose
124+
## Fragments in Compose (Transitionary Step)
117125

118126
Use the `AndroidFragment` composable to add a `Fragment` in Compose.
119127
`AndroidFragment` has fragment-specific handling such as removing the
120128
fragment when the composable leaves the composition.
121129

130+
> [!NOTE]
131+
> **Note:** Wrap existing Fragments in Compose only during incremental migration. For Compose-only apps, do not use Fragments and instead use the recommended Compose-only architecture with a single Activity and latest navigation libraries, like Navigation 3.
132+
122133
To include a fragment, use the [`AndroidFragment`](https://developer.android.com/reference/kotlin/androidx/fragment/compose/package-summary#AndroidFragment)
123134
composable. You pass a `Fragment` class to `AndroidFragment`, which then adds
124135
an instance of that class directly into the composition. `AndroidFragment` also

jetpack-compose/migration/migrate-xml-views-to-jetpack-compose/references/android/develop/ui/compose/setup-compose-dependencies-and-compiler.md

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
## Set up the Compose Compiler Gradle plugin
22

3-
For Gradle users, you can use the Compose Compiler Gradle plugin to make setting
4-
up and configuring Compose easier.
3+
For Gradle, use the Compose Compiler Gradle plugin to set
4+
up and configure Compose.
55

66
> [!NOTE]
77
> **Note:** The Compose Compiler Gradle Plugin is only available from Kotlin 2.0+. For migration instructions, see ["Jetpack Compose compiler moving to the Kotlin
8-
> repository"](https://android-developers.googleblog.com/2024/04/jetpack-compose-compiler-moving-to-kotlin-repository.html). For an example migration, see the [Compose Samples
9-
> PR](https://github.com/android/compose-samples/pull/1354) in the Compose samples.
8+
> repository"](https://android-developers.googleblog.com/2024/04/jetpack-compose-compiler-moving-to-kotlin-repository.html).
109
1110
### Set up with Gradle version catalogs
1211

13-
The following instructions outline how you can set up the Compose Compiler
14-
Gradle plugin:
12+
Set up the Compose Compiler Gradle plugin:
1513

16-
1. In your `libs.versions.toml` file, remove any reference to the Compose Compiler.
17-
2. In the `versions` and `plugins` section, add the following new dependency:
14+
1. In the `libs.versions.toml` file, remove any reference to the Compose Compiler.
15+
2. In the `versions` and `plugins` sections, add the new dependency:
1816

1917
[versions]
2018
kotlin = "2.3.10"
@@ -25,36 +23,34 @@ Gradle plugin:
2523
// Add this line
2624
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
2725

28-
1. In your project's root `build.gradle.kts` file, add the following snippet to the `plugins` section.
26+
1. In the project's root `build.gradle.kts` file, add the following to the `plugins` section.
2927

3028
plugins {
3129
// Existing plugins
3230
alias(libs.plugins.compose.compiler) apply false
3331
}
3432

35-
1. In each module that uses Compose, apply the plugin as follows.
33+
1. In each module that uses Compose, apply the plugin:
3634

3735
plugins {
3836
// Existing plugins
3937
alias(libs.plugins.compose.compiler)
4038
}
4139

42-
Your app should now build and compile if you are using the default set up. If
43-
you had configured custom options on the Compose compiler, see the following
40+
The project should now build and compile if it was using the default set up. If
41+
it had configured custom options on the Compose compiler, follow the next
4442
section.
4543

4644
### Set up the Compose Compiler without Gradle version catalogs
4745

48-
Add the
49-
following plugin to `build.gradle.kts` files associated with modules you use
50-
Compose:
46+
Add the plugin to `build.gradle.kts` files associated with modules where Compose
47+
is used:
5148

5249
plugins {
5350
id("org.jetbrains.kotlin.plugin.compose") version "2.3.10" // this version matches your Kotlin version
5451
}
5552

56-
You might also need to add this classpath to your top-level project
57-
`build.gradle.kts` file:
53+
Add the classpath to your top-level project `build.gradle.kts` file:
5854

5955
buildscript {
6056
dependencies {
@@ -66,7 +62,7 @@ You might also need to add this classpath to your top-level project
6662

6763
To configure the Compose compiler using the Gradle plugin, add the
6864
`composeCompiler` block to the module's `build.gradle.kts` file at the top
69-
level.
65+
level:
7066

7167
android { ... }
7268

@@ -79,6 +75,11 @@ For the full list of available options, see the [documentation](https://www.jetb
7975

8076
## Set up Compose dependencies
8177

78+
Always use the latest Compose BOM version: `2026.03.00`.
79+
80+
Set the `compose` flag to `true` inside the Android [`BuildFeatures`](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/dsl/BuildFeatures)
81+
to enable [Compose functionality](https://developer.android.com/develop/ui/compose/tooling) in Android Studio.
82+
8283
Add the following definition to your app's `build.gradle` file:
8384

8485
### Groovy
@@ -97,11 +98,7 @@ Add the following definition to your app's `build.gradle` file:
9798
}
9899
}
99100

100-
Setting the `compose` flag to `true` inside the Android [`BuildFeatures`](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/dsl/BuildFeatures)
101-
block enables [Compose functionality](https://developer.android.com/develop/ui/compose/tooling) in Android Studio.
102-
103-
Finally, add the Compose BOM and the subset of Compose library dependencies
104-
you need to your dependencies from the following block:
101+
Add the Compose BOM and the subset of Compose library dependencies:
105102

106103
### Groovy
107104

jetpack-compose/migration/migrate-xml-views-to-jetpack-compose/references/xml-layout-migration.md

Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,50 @@
11
## 1. Structural analysis \& mapping
22

3-
**Identify the precise mapping** between XML elements and Compose equivalents. You must determine:
4-
\* The exact `@Composable` functions (e.g., `ConstraintLayout`, `Column`, `LazyColumn`) that replace the XML tag hierarchy.
5-
\* The specific parameters and `Modifier` extensions required to replicate XML attributes (e.g., `layout_width`, `padding`, `elevation`).
6-
\* The appropriate state management strategy for interactive elements.
3+
**Identify the precise mapping** between XML elements and Compose equivalents.
4+
You must determine:
5+
6+
- The exact `@Composable` functions (e.g., `ConstraintLayout`, `Column`, `LazyColumn`) that replace the XML tag hierarchy.
7+
- The specific parameters and `Modifier` extensions required to replicate XML attributes (e.g., `layout_width`, `padding`, `elevation`).
8+
- The appropriate state management strategy for interactive elements.
79

810
## 2. Migration execution
911

10-
**Convert the XML layout code to Jetpack Compose**, ensuring the visual hierarchy and layout logic are preserved while leveraging Compose's declarative nature.
12+
**Convert the XML layout code to Jetpack Compose**, ensuring the visual
13+
hierarchy and layout logic are preserved while leveraging Compose's declarative
14+
nature.
1115

1216
## 3. Theming \& design system integrity
1317

1418
**Do not use hard-coded values.** Follow these rules for styling:
15-
\* **Token Alignment:** Cross-reference XML dimension, color, and style attributes with the existing Compose `Theme` (e.g., `MaterialTheme.colorScheme` or custom design system tokens).
16-
\* **Reuse over Creation:** If matching values exist in the current Compose theme, reuse them. If a value is missing but required for the design, define it within the theme structure rather than hard-coding it in the Composable.
17-
\* **Project Consistency:** You **MUST** strictly adhere to existing code conventions, naming standards, and implementation patterns found in the project. **Prioritize** project-specific reusable components over generic Material defaults.
19+
20+
- **Token Alignment:** Cross-reference XML dimensions, colors, and style attributes with the existing Compose `Theme` (e.g., `MaterialTheme.colorScheme` or custom design system tokens).
21+
- **Reuse over Creation:** If matching values exist in the current Compose theme, reuse them. If a value is missing but required for the design, define it within the theme structure rather than hard-coding it in the Composable.
22+
- **Project Consistency:** You **MUST** strictly adhere to existing code conventions, naming standards, and implementation patterns found in the project. **Prioritize** project-specific reusable components over generic Material defaults.
1823

1924
## 4. Component layering \& reusability
2025

21-
Evaluate if the XML layout serves as a foundation-level design system component (reused across the app with a distinct role). If it is:
22-
\* **Create a reusable composable:** Do not just inline the code. Define a new standalone `@Composable`.
23-
\* **Parameterization:** Expose specific parameters for variable data (text, colors, styles) and use `Modifier` for layout-specific customizations.
24-
\* **Feature parity \& restriction:** Ensure the new composable enforces the same UI constraints as the original XML component, preventing unauthorized style overrides while maintaining the intended flexibility.
26+
Evaluate if the XML layout serves as a foundation-level design system component
27+
(reused across the app with a distinct role). If it is:
28+
29+
- **Create a reusable composable:** Do not just inline the code. Define a new standalone `@Composable`.
30+
- **Parameterization:** Expose specific parameters for variable data (text, colors, styles) and use `Modifier` for layout-specific customizations.
31+
- **Feature parity \& restriction:** Ensure the new composable enforces the same UI constraints as the original XML component, preventing unauthorized style overrides while maintaining the intended flexibility.
2532

2633
Example before migration:
27-
```xml
28-
<style
29-
name="Widget.Rounded.Button"
30-
parent="Widget.Button.Borderless">
31-
<item name="android:fontFamily">sans-serif-medium</item>
32-
<item name="android:minWidth">@dimen/min_width</item>
33-
<item name="android:paddingStart">@dimen/padding_2</item>
34-
<item name="android:paddingEnd">@dimen/padding_2</item>
35-
<item name="cornerRadius">8dp</item>
36-
</style>
37-
```
34+
35+
<style
36+
name="Widget.Rounded.Button"
37+
parent="Widget.Button.Borderless">
38+
<item name="android:fontFamily">sans-serif-medium</item>
39+
<item name="android:minWidth">@dimen/min_width</item>
40+
<item name="android:paddingStart">@dimen/padding_2</item>
41+
<item name="android:paddingEnd">@dimen/padding_2</item>
42+
<item name="cornerRadius">8dp</item>
43+
</style>
3844

3945
Example after migration:
4046

47+
4148
```kotlin
4249
@Composable
4350
fun RoundedBorderlessButton(
@@ -68,6 +75,10 @@ fun RoundedBorderlessButton(
6875
}
6976
```
7077

78+
<br />
79+
80+
*** ** * ** ***
81+
7182
## 5. Output requirements
7283

7384
- Provide the full Kotlin file content.

navigation/navigation-3/references/android/guide/navigation/navigation-3/migration-guide.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ To migrate your app from [Navigation 2](https://developer.android.com/guide/navi
88
6. Replace `NavHost` with `NavDisplay`.
99
7. Remove Navigation 2 dependencies.
1010

11+
> [!IMPORTANT]
12+
> **Important:** We released an agent skill to help you install and migrate to Jetpack Navigation 3. Try out the skill from the [Android skills repository](https://github.com/android/skills).
13+
1114
<br />
1215

1316

navigation/navigation-3/references/android/guide/navigation/navigation-3/recipes/conditional.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ import androidx.compose.material3.Button
4848
import androidx.compose.material3.Text
4949
import androidx.compose.runtime.Composable
5050
import androidx.compose.runtime.getValue
51-
import androidx.compose.runtime.setValue
5251
import androidx.compose.runtime.mutableStateOf
5352
import androidx.compose.runtime.remember
5453
import androidx.compose.runtime.saveable.rememberSaveable
5554
import androidx.compose.runtime.saveable.rememberSerializable
55+
import androidx.compose.runtime.setValue
5656
import androidx.lifecycle.compose.dropUnlessResumed
5757
import androidx.navigation3.runtime.NavBackStack
5858
import androidx.navigation3.runtime.NavKey
@@ -63,6 +63,7 @@ import androidx.navigation3.ui.NavDisplay
6363
import com.example.nav3recipes.content.ContentBlue
6464
import com.example.nav3recipes.content.ContentGreen
6565
import com.example.nav3recipes.content.ContentYellow
66+
import com.example.nav3recipes.ui.setEdgeToEdgeConfig
6667
import kotlinx.serialization.Serializable
6768
6869
@@ -103,6 +104,7 @@ private data class Login(
103104
class ConditionalActivity : ComponentActivity() {
104105
105106
override fun onCreate(savedInstanceState: Bundle?) {
107+
setEdgeToEdgeConfig()
106108
super.onCreate(savedInstanceState)
107109
setContent {
108110

navigation/navigation-3/references/android/guide/navigation/navigation-3/recipes/deeplinks-advanced.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import com.example.nav3recipes.common.deeplink.LIST_LOCATIONS
4646
import com.example.nav3recipes.common.deeplink.MenuDropDown
4747
import com.example.nav3recipes.common.deeplink.PaddedButton
4848
import com.example.nav3recipes.common.deeplink.TextContent
49+
import com.example.nav3recipes.ui.setEdgeToEdgeConfig
4950
5051
internal const val ADVANCED_PATH_BASE = "https://www.nav3deeplink.com"
5152
@@ -68,6 +69,7 @@ internal const val ADVANCED_PATH_BASE = "https://www.nav3deeplink.com"
6869
class AdvancedCreateDeepLinkActivity: ComponentActivity() {
6970
7071
override fun onCreate(savedInstanceState: Bundle?) {
72+
setEdgeToEdgeConfig()
7173
super.onCreate(savedInstanceState)
7274
7375
setContent {

0 commit comments

Comments
 (0)