android-gradle-expert
Skill11 starsChanged 8 months agoMITView on GitHub
Use when configuring Gradle builds, managing dependencies, or modularizing Android applications.
In this repository40 other files it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
- android-accessibilitySkill
- android-adaptive-layoutsSkill
- android-adb-terminalSkill
- android-background-executionSkill
- android-bluetooth-bleSkill
- android-build-verificationSkill
- android-camerax-mlkitSkill
- android-ci-cd-expertSkill
- android-clean-architectureSkill
- android-code-review-expertSkill
- android-coroutines-expertSkill
- android-custom-drawing-canvasSkill
- android-design-system-m3Skill
- android-design-to-codeSkill
- android-detekt-expertSkill
- android-enterprise-securitySkill
- android-gemini-nanoSkill
- android-google-workspace-expertSkill
- android-hardware-testingSkill
- android-jetpack-composeSkill
- android-kmp-compose-uiSkill
- android-kmp-platform-channelsSkill
- android-kmp-sharedSkill
- android-ktlint-formattingSkill
- android-lint-and-qualitySkill
- android-local-stt-ttsSkill
- android-location-mapsSkill
- android-macrobenchmarkSkill
- android-media3-exoplayerSkill
- android-media-and-image-expertSkill
- android-motion-animationsSkill
- android-navigation-expertSkill
- android-offline-firstSkill
- android-performance-auditSkill
- android-rag-localSkill
- android-screenshot-testingSkill
- android-security-hardenedSkill
- android-unit-testingSkill
- android-wear-os-composeSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 4 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 32
Before starting any Gradle configuration, ensure the following core files are present and properly configured:
- Distinctive: line 36
Rule: ALWAYS use a modern Gradle version (8.4+) to support Kotlin 1.9.x+ and modern AGP (8.3.x+).
- Very specific: line 55
Rule: Never hardcode versions in build.gradle.kts.
- Distinctive: line 79
When scaffolding a new Compose project, ensure these are added to prevent compilation/runtime errors:
- Distinctive: line 94
Rule: ALWAYS enable shrinking (minifyEnabled) for release builds.
- Very specific: line 95
Best Practice: Use proguard-android-optimize.txt and keep domain models/API DTOs if necessary.
- Very specific: line 114
Use testOptions for unit tests and instrumented tests.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Android Gradle Expertise 🐘💎
The ultimate guide to modern, efficient, and modular Android builds with Gradle Kotlin DSL and Version Catalogs.
⚡ When to Use
- Dependency Management: Centralizing versions and libraries.
- Build Types & Flavors: Implementing environments (staging, prod) or product variants.
- Modularization: Splitting data, UI, or library modules.
- Gradle Performance: Optimizing build times.
- Code Optimization: Configuring R8, ProGuard, and shrinking.
- Release Automation: Signing APKs/AABs.
🏗️ Foundational Build Files
Before starting any Gradle configuration, ensure the following core files are present and properly configured:
1. gradle-wrapper.properties (8.4+)
- Rule: ALWAYS use a modern Gradle version (8.4+) to support Kotlin 1.9.x+ and modern AGP (8.3.x+).
- Core Setting:
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
2. gradle.properties (AndroidX & Performance)
- Role: Enabling Modern Android support and build performance.
Mandatory:
android.useAndroidX=true android.enableJetifier=true org.gradle.parallel=true org.gradle.caching=true
🏗️ Modern Build Standards
1. Version Catalogs (libs.versions.toml)
- Rule: Never hardcode versions in
build.gradle.kts. Use the catalog. Structure:
[versions] compose = "1.6.0" kotlin = "2.0.0" [libraries] compose-ui = { group = "androidx.compose.ui", name = "ui", version.ref = "compose" } [plugins] android-app = { id = "com.android.application", version = "8.3.0" }
2. Kotlin DSL (.kts)
- Consistently use Kotlin for build scripts for type-safety and IDE support.
3. Convention Plugins
- For multi-module projects, use "Convention Plugins" (in
build-logic) to share common build logic (e.g., Compose setup, Hilt, Room).
4. Crucial Dependencies (Often Missed)
When scaffolding a new Compose project, ensure these are added to prevent compilation/runtime errors:
- Image Loading:
io.coil-kt:coil-compose - Hilt Navigation:
androidx.hilt:hilt-navigation-compose - Adaptive UI:
androidx.compose.material3:material3-window-size-class - Security:
androidx.biometric:biometric(use androidx, NOTandroid.hardware.biometricsfor UI prompts)
🚀 Build Optimization
- Configuration Caching: Enable
org.gradle.configuration-cache=true. - Parallel Execution: Enable
org.gradle.parallel=true. - Daemon: Ensure
org.gradle.daemon=true. - Build Build Cache: Use local/remote build cache for faster CI.
🛡️ Code Shrinking (R8/ProGuard)
- Rule: ALWAYS enable shrinking (minifyEnabled) for release builds.
- Best Practice: Use
proguard-android-optimize.txtand keep domain models/API DTOs if necessary.buildTypes { release { isMinifyEnabled = true proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") } }
📦 Modularization Patterns
- app: Root plugin and theme.
- feature:[name]: Self-contained UI and ViewModels.
- core:[name]: Shared libraries (Network, Database, UI Components).
- domain: Shared models and use cases (if needed globally).
🧪 Testing with Gradle
- Use
testOptionsfor unit tests and instrumented tests. - Screenshot testing: Integrate tools like Paparazzi directly into the Gradle task.
🛠️ Troubleshooting & Compatibility
- Compose vs Kotlin: The Compose Compiler is strictly tied to specific Kotlin versions. If versions mismatch, the build fails.
- The Solution (Kotlin < 2.0):
- Consult the Official Compatibility Map.
- Define
composeCompilerinlibs.versions.toml(e.g.,1.5.10for Kotlin1.9.22). - Reference in
app/build.gradle.kts:kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get().
- Kotlin 2.0+: The Compose Compiler is now integrated into the Kotlin Gradle Plugin, which eliminates version mismatch issues! Always recommend upgrading to King Kotlin 2.0+ if possible.
🔗 Related Resources
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

