All skills
kotlin avatar

/kotlin-tooling-agp9-migration

@43f4771 official
by kotlinkotlin/kotlin-agent-skills1.1k stars
42

Migrates Kotlin Multiplatform (KMP) projects to Android Gradle Plugin 9.0+. Handles plugin replacement (com.android.kotlin.multiplatform.library), module splitting, DSL migration, and the new default project structure. Use when upgrading AGP, when build fails due to KMP+AGP incompatibility, or when the user mentions AGP 9.0, android multiplatform plugin, KMP migration, or com.android.kotlin.multiplatform.library.

Use this Skill: https://skilld.dev/gh/kotlin/kotlin-agent-skills/kotlin-tooling-agp9-migration

This session only. Nothing lands on disk.

assetschecklist.md

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

KMP AGP 9.0 Migration Verification Checklist

Use this checklist after migration to verify everything is configured correctly.

Plugin Configuration

  • com.android.kotlin.multiplatform.library plugin declared for KMP library modules
  • No com.android.library or com.android.application in KMP modules' build.gradle.kts
  • org.jetbrains.kotlin.android removed from all build files and version catalog (built-in Kotlin replaces it)
  • No org.jetbrains.kotlin.kapt plugin — migrated to KSP or com.android.legacy-kapt
  • android.kotlinOptions {} migrated to kotlin { compilerOptions {} } (non-KMP modules)
  • kotlin.sourceSets migrated to android.sourceSets with .kotlin accessor (non-KMP modules)
  • No android.builtInKotlin=false unless required by incompatible plugin (documented as temporary)
  • Third-party plugins verified compatible

KMP Library Modules

  • Source sets renamed: androidMain, androidHostTest, androidDeviceTest
  • No android {} top-level block — use androidLibrary {} inside kotlin {} instead
  • androidResources { enable = true } present if module uses Android or Compose Multiplatform resources
  • withJava() present if module has .java source files
  • Tests configured: withHostTest {}, withDeviceTest {}
  • No debugImplementation or analogs in library modules
    • use androidRuntimeClasspath for tooling deps
    • app modules can still use debugImplementation
  • Unique namespace for each library module (different from app module; android.uniquePackageNames=true is default in AGP 9.0)

Gradle Properties & DSL

  • No removed properties in gradle.properties that cause errors:
    • android.enableLegacyVariantApi
    • android.r8.integratedResourceShrinking
    • android.enableNewResourceShrinker.preciseShrinking
  • Any opt-out flags (android.newDsl=false, android.builtInKotlin=false) documented with reason
  • targetSdk explicitly set in all app modules (defaults to compileSdk now, was minSdk)

Build Logic / Convention Plugins

  • No references to BaseExtension, AppExtension, LibraryExtension (removed in AGP 9.0)
  • Using CommonExtension or specific new DSL types
  • No use of removed APIs: applicationVariants, libraryVariants, variantFilter

ProGuard / R8

  • Consumer ProGuard rules migrated to consumerProguardFiles.add(file(...)) in new DSL
  • Using proguard-android-optimize.txt (not proguard-android.txt)
  • No global options (-dontobfuscate, -dontoptimize) in library consumer rules
  • Keep rules updated for R8 strict full mode (explicit default constructor rules if needed)

Build & Test Verification

  • ./gradlew build succeeds
  • ./gradlew :androidApp:assembleDebug succeeds (if app module exists)
  • xcodebuild -project iosApp/*.xcodeproj -scheme <scheme> -sdk iphonesimulator build succeeds (if iOS app exists)
  • Desktop app compiles: ./gradlew :desktopApp:run or equivalent (if desktop target exists)
  • Web/Wasm target compiles: ./gradlew :wasmJsApp:wasmJsBrowserDistribution or equivalent (if web target exists)
  • ./gradlew :shared:allTests succeeds (or equivalent for KMP test tasks)
  • ./gradlew :androidApp:testDebugUnitTest succeeds (if app module exists)
  • No deprecation warnings about variant API or DSL

Source: SKILL.md on GitHub

No alerts16d5 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    This skill provides documentation and tools to assist in migrating Kotlin Multiplatform projects to Android Gradle Plugin (AGP) 9.0+. It includes guides for library modules, application splits, and a project analysis script. No security risks were identified.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer6mo

    5/10 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

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

Last checked against GitHub 3 weeks ago.

Activeupdated 6 months ago
metadata
{
  "author": "JetBrains",
  "version": "1.0.0"
}
  • kotlin
  • kmp
  • agp
  • android-gradle-plugin
  • migrations
  • multiplatform
  • gradle
  • android

README badge

README badge for kotlin/kotlin-agent-skills/kotlin-tooling-agp9-migration

Migrates Kotlin Multiplatform projects to Android Gradle Plugin 9.0+, which requires separating the Android application plugin from KMP. Handles plugin replacement, DSL migration, module splitting, and directory structure updates for both library and application modules.

Generated from the current SKILL.md.

Does this skill handle all KMP+AGP migration scenarios?
The skill covers three main paths: library modules (Path A), mandatory app+shared splits for AGP 9.0 (Path B), and recommended full restructures from monolithic modules (Path C). It assumes Kotlin Multiplatform projects; pure Android projects need only AGP version updates.
Do I need to remove the kotlin-android plugin?
Yes. AGP 9.0 has built-in Kotlin support, so org.jetbrains.kotlin.android must be removed from any module using AGP 9.0 plugins.
What happens to KAPT dependencies?
The skill identifies KAPT usage as incompatible with AGP 9.0. You must migrate to KSP or use com.android.legacy-kapt; the skill guides detection but does not automate the migration.
Do I need to rename my source directories?
Only if your module uses classic Android layout (src/main, src/test, src/androidTest). If it already uses KMP layout (src/androidMain, etc.), no directory renames are needed.
What Gradle and AGP versions does this target?
Gradle 9.1.0+ and AGP 9.0.0+. The skill includes gradle-wrapper updates and version catalog examples for both.

Generated from the current SKILL.md. These answers refresh after source changes.