Skip to content
android-gradle logo

Android Gradle Skill

android-gradle

Automate Gradle tasks for Android projects - build, test, coverage, clean. Use when building APKs, running unit tests, generating coverage reports, or checking dependencies.

SKILL.md

Full skill instructions

Android Gradle Skill

Automate Gradle tasks for Android projects: build, test, coverage, clean.

When to Use

  • Building debug/​release APK
  • Running unit tests
  • Generating coverage reports
  • Cleaning build cache
  • Checking dependencies

Commands

Build Commands

CommandDescriptionGradle Task
buildBuild debug APK./​gradlew assembleDebug
build:releaseBuild release APK./​gradlew assembleRelease
installInstall to device./​gradlew installDebug
cleanClean build cache./​gradlew clean
rebuildClean + build./​gradlew clean assembleDebug

Test Commands

CommandDescriptionGradle Task
testRun all unit tests./​gradlew testDebugUnitTest
test:classRun single class./​gradlew test --tests "*.ClassName"
test:methodRun single test./​gradlew test --tests "*.Class.method"

Coverage Commands

CommandDescriptionGradle Task
coverageFull coverage report./​gradlew jacocoTestDebugUnitTestReport
coverage:verifyEnforce 80% minimum./​gradlew jacocoVerification

Dependency Commands

CommandDescriptionGradle Task
depsShow dependency tree./​gradlew dependencies
deps:appApp module only./​gradlew :app:dependencies
outdatedCheck outdated deps./​gradlew dependencyUpdates

Usage Examples

# Build and install debug APK
./​gradlew assembleDebug && ./​gradlew installDebug

# Run specific test class
./​gradlew test --tests "*.GameManagerImplTest"

# Generate coverage report
./​gradlew jacocoTestDebugUnitTestReport
# Report at: app/​build/​reports/​jacoco/​jacocoTestDebugUnitTestReport/​html/​index.html

# Clean rebuild
./​gradlew clean assembleDebug

Timeout Configuration

Task TypeTimeout
assembleDebug2 min
testDebugUnitTest3 min
jacocoTestDebugUnitTestReport2 min
clean30 sec
dependencies30 sec

Version Compatibility

GradleAGPKotlinJDK
8.10+8.8+2.1+17+
8.5+8.5+2.0+17+
8.0+8.0+1.9+17+

Error Handling

// Handle build failures in scripts
fun handleGradleResult(exitCode: Int, output: String) {
    when {
        exitCode != 0 && output.contains("Compilation failed") ->
            println("Fix compilation errors in: ${extractErrorFiles(output)}")
        exitCode != 0 && output.contains("AAPT") ->
            println("Resource error - check XML files")
        exitCode != 0 && output.contains("OutOfMemoryError") ->
            println("Increase heap: org.gradle.jvmargs=-Xmx4g")
    }
}

Common Errors:

  • Build failure: Parse error message, check file:line references
  • Test failure: Run with --info for stack traces
  • Coverage below threshold: Check app/​build/​reports/​jacoco/​*/​html/​index.html
  • OOM: Increase heap in gradle.properties

Test Result Validation

# Run tests and validate results
./​gradlew testDebugUnitTest && echo "✓ All tests passed" || echo "✗ Tests failed"

# Check coverage threshold
./​gradlew jacocoTestDebugUnitTestReport
# Verify: app/​build/​reports/​jacoco/​jacocoTestDebugUnitTestReport/​html/​index.html
# Target: 80%+ line coverage

# Parse test results programmatically
cat app/​build/​test-results/​testDebugUnitTest/​*.xml | grep -E "(tests=|failures=)"

Troubleshooting

IssueSolution
Build hangsKill daemon: ./​gradlew --stop
Cache issuesClean: ./​gradlew clean cleanBuildCache
OOM errorsAdd to gradle.properties: org.gradle.jvmargs=-Xmx4g
Version conflictForce resolution in build.gradle.kts
Slow buildsEnable: org.gradle.parallel=true

Command Workflows

# Full CI workflow
./​gradlew clean testDebugUnitTest jacocoTestDebugUnitTestReport assembleDebug

# Quick iteration
./​gradlew assembleDebug -x lint -x test && ./​gradlew installDebug

# Pre-commit check
./​gradlew ktlintCheck testDebugUnitTest

CI/​CD Integration

# GitHub Actions example
- name: Build & Test
  run: |
    ./​gradlew testDebugUnitTest
    ./​gradlew jacocoTestDebugUnitTestReport
    ./​gradlew assembleDebug

- name: Upload Coverage
  uses: codecov/​codecov-action@v4
  with:
    files: app/​build/​reports/​jacoco/​*/​jacoco*.xml

Best Practices

  • Always use Gradle wrapper (./​gradlew), never system Gradle
  • Use --parallel for multi-module projects
  • Enable configuration cache for faster builds
  • Skip lint with -x lint if not needed for quick iterations

References

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View