| name | android-gradle |
| description | Build, test, and manage Android projects using Gradle. Use for running builds, executing tests, checking dependencies, and managing version catalogs. |
Android Gradle Skill
This skill helps automate Android build tasks.
Requirements
gradle or ./gradlew must be available in the project root.
Usage
Run a Build
./gradlew assembleDebug
Run Unit Tests
./gradlew test
Run Lint
./gradlew lint
List Dependencies
./gradlew app:dependencies
Update Dependencies
Use the agent to modify build.gradle.kts or libs.versions.toml.
Safe Build Workflow (Build & Rollback)
When making changes to build files (build.gradle.kts, libs.versions.toml), use this safety-first approach:
- Snapshot: Ensure current changes are committed or stashed.
- Apply Change: Modify the build file.
- Test Build: Run
./gradlew assembleDebug (or a relevant task).
- Validate:
- If Success: Keep changes.
- If Failure:
- Capture the error log.
- Rollback changes (e.g.,
git checkout path/to/file or undo).
- Analyze the error and try a different approach.
Automated Check Command
./gradlew assembleDebug || (echo "BUILD FAILED - ROLLING BACK" && git checkout .)