Files
affaan-m--everything-claude…/commands/gradle-build.md
T
wehub-resource-sync d48cda4081
CI / Test (ubuntu-latest, Node 18.x, bun) (push) Failing after 15m1s
CI / Test (ubuntu-latest, Node 18.x, npm) (push) Failing after 15m1s
CI / Test (ubuntu-latest, Node 18.x, pnpm) (push) Failing after 15m1s
CI / Test (ubuntu-latest, Node 18.x, yarn) (push) Failing after 15m1s
CI / Test (ubuntu-latest, Node 20.x, bun) (push) Failing after 17m13s
CI / Test (ubuntu-latest, Node 20.x, npm) (push) Failing after 18m42s
CI / Test (ubuntu-latest, Node 20.x, pnpm) (push) Failing after 15m0s
CI / Test (ubuntu-latest, Node 20.x, yarn) (push) Failing after 49m44s
CI / Test (ubuntu-latest, Node 22.x, bun) (push) Failing after 51m55s
CI / Test (ubuntu-latest, Node 22.x, pnpm) (push) Failing after 21m57s
CI / Test (ubuntu-latest, Node 22.x, npm) (push) Failing after 37m39s
CI / Test (ubuntu-latest, Node 22.x, yarn) (push) Failing after 34m7s
CI / Validate Components (push) Failing after 37m15s
CI / Python Tests (push) Failing after 10m1s
CI / Security Scan (push) Failing after 10m1s
CI / Lint (push) Failing after 17m12s
CI / Coverage (push) Failing after 20m19s
CI / Test (macos-latest, Node 18.x, bun) (push) Has been cancelled
CI / Test (macos-latest, Node 18.x, npm) (push) Has been cancelled
CI / Test (macos-latest, Node 18.x, pnpm) (push) Has been cancelled
CI / Test (macos-latest, Node 18.x, yarn) (push) Has been cancelled
CI / Test (windows-latest, Node 18.x, npm) (push) Has been cancelled
CI / Test (windows-latest, Node 18.x, pnpm) (push) Has been cancelled
CI / Test (windows-latest, Node 18.x, yarn) (push) Has been cancelled
CI / Test (macos-latest, Node 20.x, bun) (push) Has been cancelled
CI / Test (macos-latest, Node 20.x, npm) (push) Has been cancelled
CI / Test (macos-latest, Node 20.x, pnpm) (push) Has been cancelled
CI / Test (macos-latest, Node 20.x, yarn) (push) Has been cancelled
CI / Test (windows-latest, Node 20.x, npm) (push) Has been cancelled
CI / Test (windows-latest, Node 20.x, pnpm) (push) Has been cancelled
CI / Test (windows-latest, Node 20.x, yarn) (push) Has been cancelled
CI / Test (macos-latest, Node 22.x, bun) (push) Has been cancelled
CI / Test (macos-latest, Node 22.x, npm) (push) Has been cancelled
CI / Test (macos-latest, Node 22.x, pnpm) (push) Has been cancelled
CI / Test (macos-latest, Node 22.x, yarn) (push) Has been cancelled
CI / Test (windows-latest, Node 22.x, npm) (push) Has been cancelled
CI / Test (windows-latest, Node 22.x, pnpm) (push) Has been cancelled
CI / Test (windows-latest, Node 22.x, yarn) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 11:55:55 +08:00

2.5 KiB

description
description
Fix Gradle build errors for Android and KMP projects

Gradle Build Fix

Incrementally fix Gradle build and compilation errors for Android and Kotlin Multiplatform projects.

Step 1: Detect Build Configuration

Identify the project type and run the appropriate build:

Indicator Build Command
build.gradle.kts + composeApp/ (KMP) ./gradlew composeApp:compileKotlinMetadata 2>&1
build.gradle.kts + app/ (Android) ./gradlew app:compileDebugKotlin 2>&1
settings.gradle.kts with modules ./gradlew assemble 2>&1
Detekt configured ./gradlew detekt 2>&1

Also check gradle.properties and local.properties for configuration.

Step 2: Parse and Group Errors

  1. Run the build command and capture output
  2. Separate Kotlin compilation errors from Gradle configuration errors
  3. Group by module and file path
  4. Sort: configuration errors first, then compilation errors by dependency order

Step 3: Fix Loop

For each error:

  1. Read the file — Full context around the error line
  2. Diagnose — Common categories:
    • Missing import or unresolved reference
    • Type mismatch or incompatible types
    • Missing dependency in build.gradle.kts
    • Expect/actual mismatch (KMP)
    • Compose compiler error
  3. Fix minimally — Smallest change that resolves the error
  4. Re-run build — Verify fix and check for new errors
  5. Continue — Move to next error

Step 4: Guardrails

Stop and ask the user if:

  • Fix introduces more errors than it resolves
  • Same error persists after 3 attempts
  • Error requires adding new dependencies or changing module structure
  • Gradle sync itself fails (configuration-phase error)
  • Error is in generated code (Room, SQLDelight, KSP)

Step 5: Summary

Report:

  • Errors fixed (module, file, description)
  • Errors remaining
  • New errors introduced (should be zero)
  • Suggested next steps

Common Gradle/KMP Fixes

Error Fix
Unresolved reference in commonMain Check if the dependency is in commonMain.dependencies {}
Expect declaration without actual Add actual implementation in each platform source set
Compose compiler version mismatch Align Kotlin and Compose compiler versions in libs.versions.toml
Duplicate class Check for conflicting dependencies with ./gradlew dependencies
KSP error Run ./gradlew kspCommonMainKotlinMetadata to regenerate
Configuration cache issue Check for non-serializable task inputs