Index of every page on this site: llms.txt
All skills
android avatar

/agp-9-upgrade

@7f7b217
by androidandroid/skills11k stars
703
Run it yourself

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.

Use this Skill: https://skilld.dev/gh/android/skills/agp-9-upgrade

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesrecipes.md

≈561 tokens on demand. Your agent reads this file only when SKILL.md points to it.

When migrating to AGP's new DSL, any Gradle code (plugins or logic in build scripts) that relied on the old DSL will stop working. Such code must be migrated.

Guidelines

  • DO NOT search the web for examples of how to do this. Use the gradle-recipes repository examples only.
  • DO NOT use AGP internals in migrated code.
  • DO use only public APIs in migrated code.

In some cases, there is a one-to-one replacement for the old code. Some examples are in the AGP 9.0.0 release notes.

In other cases, there is no direct one-to-one replacement. For these situations, the gradle-recipes repo is a great resource. You can checkout one of its AGP 9.x branches, such as agp-9.0, agp-9.1, or agp-9.2. These branches contain recipes for common situations in Android projects. The following table lists the compatibility for recipes for each version of AGP.

Compatibility table

AGP version gradle-recipes branch
9.0.x agp-9.0
9.1.x agp-9.1
9.2.x agp-9.2

Recipes and use-cases

The following table links use-cases to recipes.

Recipe Use-case
addCustomBuildConfigFields Add custom BuildConfig fields
listenToArtifacts Rename APK

Additional details for each use-case follow.

Add custom BuildConfig fields

See the detailed guide at BuildConfig.

Renaming an APK

In the old DSL, an APK could be renamed very simply. Here's an example:

android {
  applicationVariants.all {
    outputs.all {
      val output = this as com.android.build.gradle.api.ApkVariantOutput
      val fileName = output.outputFileName
      if (fileName.contains("release")) {
        output.outputFileName = "my-cool-new-name.apk"
      }
    }
  }
}

However, with AGP 9 and the new DSL, applicationVariants is no longer available. You must instead react to artifact creation using the androidComponents.onVariants API. A complete example of this is available in the gradle-recipes repository in the listenToArtifacts recipe.

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alertstoday3 checks · Risk SAFE
  • Gen Agent Trust Hubtoday

    The skill upgrades Android projects to AGP 9. It executes build commands and reads dependency files from the local Gradle cache to perform upgrades, so ensure the project being upgraded is from a trusted source.

  • Socket6d

    No alerts

  • Snyktoday

    Risk: LOW · No issues

Signed by skilld at 7f7b217. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 34 minutes ago.

Activeupdated yesterday
Other metadata
metadata
{
  "author": "Google LLC",
  "last-updated": "2026-11-21",
  "keywords": [
    "Android Gradle Plugin 9",
    "AGP 9",
    "AGP Upgrade",
    "AGP Migration",
    "New AGP DSL",
    "Migrate to built-in Kotlin"
  ]
}

README badge

README badge for android/skills/agp-9-upgrade