一键导入
android-gradle-logic
Expert guidance on setting up scalable Gradle build logic using Convention Plugins and Version Catalogs.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Expert guidance on setting up scalable Gradle build logic using Convention Plugins and Version Catalogs.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use 1000+ external apps via Composio - either directly through the CLI or by building AI agents and apps with the SDK
Authoritative rules and patterns for production-quality Kotlin Coroutines onto Android. Covers structured concurrency, lifecycle integration, and reactive streams.
Implement navigation in Jetpack Compose using Navigation Compose. Use when asked to set up navigation, pass arguments between screens, handle deep links, or structure multi-screen apps.
Debug and optimize Android/Gradle build performance. Use when builds are slow, investigating CI/CD performance, analyzing build scans, or identifying compilation bottlenecks.
Convert Android XML layouts to Jetpack Compose. Use when asked to migrate Views to Compose, convert XML to Composables, or modernize UI from View system to Compose.
You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.
| name | android-gradle-logic |
| description | Expert guidance on setting up scalable Gradle build logic using Convention Plugins and Version Catalogs. |
This skill helps you configure a scalable, maintainable build system for Android apps using Gradle Convention Plugins and Version Catalogs, following the "Now in Android" (NiA) architecture.
Stop copy-pasting code between build.gradle.kts files. Centralize build logic (Compose setup, Kotlin options, Hilt, etc.) in reusable plugins.
Ensure your project has a build-logic directory included in settings.gradle.kts as a composite build.
root/
├── build-logic/
│ ├── convention/
│ │ ├── src/main/kotlin/
│ │ │ └── AndroidApplicationConventionPlugin.kt
│ │ └── build.gradle.kts
│ ├── build.gradle.kts
│ └── settings.gradle.kts
├── gradle/
│ └── libs.versions.toml
├── app/
│ └── build.gradle.kts
└── settings.gradle.kts
settings.gradle.ktsInclude the build-logic as a plugin management source.
// settings.gradle.kts
pluginManagement {
includeBuild("build-logic")
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
libs.versions.tomlUse the Version Catalog for both libraries and plugins.
[versions]
androidGradlePlugin = "8.2.0"
kotlin = "1.9.20"
[libraries]
# ...
[plugins]
android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }
android-library = { id = "com.android.library", version.ref = "androidGradlePlugin" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
# Define your own plugins here
nowinandroid-android-application = { id = "nowinandroid.android.application", version = "unspecified" }
Inside build-logic/convention/src/main/kotlin/AndroidApplicationConventionPlugin.kt:
import com.android.build.api.dsl.ApplicationExtension
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
class AndroidApplicationConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
with(pluginManager) {
apply("com.android.application")
apply("org.jetbrains.kotlin.android")
}
extensions.configure<ApplicationExtension> {
defaultConfig.targetSdk = 34
// Configure common options here
}
}
}
}
Do Not forget to register it in build-logic/convention/build.gradle.kts:
gradlePlugin {
plugins {
register("androidApplication") {
id = "nowinandroid.android.application"
implementationClass = "AndroidApplicationConventionPlugin"
}
}
}
Apply your custom plugin in your modules (e.g., app/build.gradle.kts):
plugins {
alias(libs.plugins.nowinandroid.android.application)
}
This drastically cleans up module-level build files.