Sign in
Explore
Prompts · PromptEveryday codingMobile & GamesReviewed

gradle-build

Fix Gradle build errors for Android and KMP projects

Kind
Prompt
Works with
Claude Code, Codex
Languages
Java / Kotlin
Source
affaan-m/ECC @ d3b8a3e90890
Path
commands/gradle-build.md
License
MIT
Jobs
Debugging
InstallCopy it from the source repository, or sign in and let the assistant adapt it for your project.
# 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`
…