skill: add Android skills

This commit is contained in:
2026-07-14 10:34:54 +08:00
parent e260c02629
commit ab82fb7cf0
182 changed files with 62992 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
When an Android module contains custom BuildConfig fields, the following steps
are necessary to ensure a correct build.
### Step 1: Enable the buildConfig build feature
In a build script:
android {
buildFeatures {
buildConfig = true
}
}
In custom build-logic for an app module:
extensions.configure<com.android.build.api.dsl.ApplicationExtension> {
buildFeatures {
buildConfig = true
}
}
In custom build-logic for a library module:
extensions.configure<com.android.build.api.dsl.LibraryExtension> {
buildFeatures {
buildConfig = true
}
}
In custom build-logic using `CommonExtension`:
extensions.configure<com.android.build.api.dsl.CommonExtension> {
buildFeatures {
buildConfig = true
}
}
### Step 2: Migrate to the new API
Use the **addCustomBuildConfigFields** recipe from the [gradle-recipes](https://developer.android.com/agents/skills/build/agp/agp-9-upgrade/references/recipes)
repository.
**IMPORTANT:** For `BuildConfigField`s with a type of `String`, the `value` field
*must* include quotation marks as part of the String. For example:
BuildConfigField(
type = "String",
value = "\"Some value\"",
comment = "Optional comment",
)
It is an **error** if the `value` field doesn't include quotation marks as
part of the String. For example, `value = "Some value"` **is an error** . This is
because the `value` is written out literally.