rcosteira79/android-skills

android-gradle-logic

Use when setting up or refactoring Android Gradle build logic — convention plugins, composite builds, version catalogs, and shared build configuration across modules.

Ver código fuente

Cómo usar

  1. Copia el comando y revisa el paquete antes de instalarlo en tu entorno de agente.
  2. Consulta las herramientas, credenciales y entornos necesarios en el documento original.
  3. Describe las entradas y el resultado deseado; contrasta la salida con las fuentes.
npx skills add https://github.com/rcosteira79/android-skills --skill android-gradle-logic

Antes de empezar

  • La instalación no incluye suscripción al modelo, cuota API ni permisos sobre tus archivos.
  • Las estrellas e instalaciones reflejan actividad, no una prueba independiente de calidad o seguridad.
Documento original del Skill

Contenido del repositorio de origen con títulos, ejemplos, código, tablas, enlaces e imágenes preservados.

Android Gradle Build Logic

Centralise build configuration in reusable Convention Plugins inside a build-logic/ composite build, so each module's build.gradle.kts collapses to plugins { alias(libs.plugins.myapp.android.library) } plus a namespace.

The canonical worked example is [nowinandroid's `build-logic/`](https://github.com/android/nowinandroid/tree/main/build-logic) — start from it rather than hand-rolling. This skill covers the wiring detail that is easy to get wrong, plus the AGP 9 deltas.

The wiring gotcha

`build-logic` does NOT inherit the root version catalog — recreate it. A composite build has its own settings.gradle.kts; the root libs catalog is invisible inside build-logic until you declare it. Without this the convention plugins can't reference libs.* and fail to compile with Unresolved reference: libs:

kotlin
// build-logic/settings.gradle.kts
dependencyResolutionManagement {
    versionCatalogs {
        create("libs") { from(files("../gradle/libs.versions.toml")) }
    }
}

Applying the plugins from the catalog

Declare the convention-plugin ids in [plugins] so modules can apply them by alias. The id must match the one you `register(...)` in build-logic — a mismatch is the usual cause of an alias that won't resolve:

toml
# gradle/libs.versions.toml
[plugins]
myapp-android-application = { id = "myapp.android.application" }
myapp-android-library     = { id = "myapp.android.library" }
myapp-android-compose     = { id = "myapp.android.compose" }

A version is not required for a locally-registered plugin — the included build supplies it, so the alias resolves whatever the catalog does or doesn't declare. nowinandroid writes version = "unspecified" explicitly, which is fine and self-documenting, just not load-bearing.

Set shared configuration — compileSdk / minSdk / Compose / the JVM toolchain — once inside the convention plugins rather than per module. For a Kotlin Android module kotlin { jvmToolchain(21) } is the idiomatic one-liner, and it sets the toolchain for both Kotlin and Java compilation:

kotlin
kotlin { jvmToolchain(21) }

AGP 9 Implications

The convention plugin pattern above targets AGP 8. AGP 9 changes several things that hit build logic directly: it drops the standalone org.jetbrains.kotlin.android plugin (Kotlin is built into com.android.application / com.android.library), removes BaseExtension and the old variant APIs (applicationVariants → androidComponents { onVariants { … } }), moves kotlinOptions {} to a top-level kotlin { compilerOptions { … } }, and makes kapt incompatible (migrate to KSP). Any convention plugin that touches these needs updating.

Defer to the dedicated migration skills for the mechanics rather than duplicating the steps here: Google's `agp-9-upgrade` for pure-Android projects, JetBrains' `kotlin-tooling-agp9-migration` for KMP, and this repo's gradle-build-performance skill for the kapt → KSP step.

Checklist

  • [ ] build-logic included as a composite build (includeBuild("build-logic")) in the root settings.gradle.kts
  • [ ] build-logic/settings.gradle.kts recreates the libs catalog via from(files("../gradle/libs.versions.toml"))
  • [ ] Convention plugins register-ed with stable ids, and the [plugins] alias ids match them exactly
  • [ ] compileSdk / minSdk / Compose / JVM toolchain set once in the plugins, not per module
del mismo repositorio

Más Skills

Todos los Skills
rcosteira79
Comunidad

gradle-build-performance

Use when Android/Gradle builds are slow — diagnosing bottlenecks with build scans, enabling configuration cache, migrating kapt to KSP, fixing cache misses, and optimizing CI/CD build times.

Instalaciones / 1h
2
GitHub Stars
170
Actualizado
19 sept
rcosteira79
Comunidad

android-data-layer

Use when implementing the data layer in Android or KMP — the Repository pattern's layered error-propagation model (repository as the error boundary, sealed DataError, Result placement with and without a domain layer) and Room in commonMain (@ConstructedBy, BundledSQLiteDriver, per-target KSP).

Instalaciones / 1h
1
GitHub Stars
155
Actualizado
19 sept
rcosteira79
Comunidad

android-debugging

Use when debugging Android or KMP issues — Android-specific techniques covering Logcat, ADB, ANR traces, R8 stack trace decoding, memory leaks, Gradle build failures, and Compose recomposition bugs, on a root-cause-first foundation.

Instalaciones / 1h
1
GitHub Stars
155
Actualizado
19 sept
rcosteira79
Comunidad

android-dev

Use this skill as the baseline for ALL Android and Kotlin Multiplatform (KMP) work — whenever the user mentions Android, Kotlin (in an Android context), KMP, CMP, commonMain, androidMain, iosMain, AndroidManifest, Gradle, build.gradle, Hilt, Dagger, Room, Retrofit, Ktor, ViewModel, LiveData, StateFlow, SharedFlow, Compose, Activity, Fragment, Intent, ADB, Logcat, MVVM, MVI, repository pattern, or any Android SDK / Jetpack / AndroidX API. Always load this skill alongside the more specific skills

Instalaciones / 1h
1
GitHub Stars
155
Actualizado
19 sept