Overview
Android development validation with Gradle build hooks for Claude Code.
Features
- Automatic build validation: Ensures your Android project compiles after agent changes
- Smart caching: Only builds when Kotlin, Java, XML, or Gradle files have changed
- Debug build: Uses
assembleDebugfor faster builds without signing
Installation
han plugin install android
Hooks
build (Stop hook)
Automatically runs when you stop Claude Code to ensure the Android project builds:
- Detects directories containing
build.gradleorbuild.gradle.ktswith Android plugin - Only runs if Kotlin, Java, XML layout, or Gradle configuration files have changed
- Runs
./gradlew assembleDebugfor fast compilation checking - Uses
--no-daemonto avoid lingering processes
Configuration
You can customize the hook behavior in your project's han-config.yml:
android:
hooks:
build:
enabled: true
# Override with a specific build variant
# command: "./gradlew assembleRelease --no-daemon -q"
To disable the hook for a specific project:
android:
hooks:
build:
enabled: false
Requirements
- Android SDK installed and configured
- Java 17+ (for modern Android projects)
- Gradle wrapper (
gradlew) in project root
Notes
- The hook only runs in directories that have Android Gradle plugin configured
- Build output is limited to the last 30 lines to keep hook output concise
- Uses
--no-daemonto prevent Gradle daemon accumulation during development
Related Plugins
- kotlin: Kotlin language skills
- java: Java language skills
- expo: React Native with Expo