원클릭으로
kmp-verify-patterns
How to verify KMP builds: compile checks, lint, common Compose compiler errors, Gradle dependency resolution issues
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
How to verify KMP builds: compile checks, lint, common Compose compiler errors, Gradle dependency resolution issues
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Template repo file structure: where screens, navigation, theme, data, and platform entries live in the monorepo
Android TV build and D-pad QA using Android CLI first, with bounded Gradle and ADB fallbacks
Expo Application Services cloud build configuration for TV app APK and IPA generation
Expo TV configuration: app.json plugins, prebuild settings, platform-specific config for react-native-tvos
Fire TV leanback manifest configuration: banner icons, LEANBACK_LAUNCHER intent filter, TV-specific Android settings
Gradle build commands: assembleDebug, assembleRelease, APK output paths, and emulator installation
| name | kmp-verify-patterns |
| description | How to verify KMP builds: compile checks, lint, common Compose compiler errors, Gradle dependency resolution issues |
| applies_to | ["scaffold","screens","branding","content"] |
| load_when | verifying code compiles, debugging build errors, or running static analysis |
After any code change, verify it compiles. Kotlin's type system catches most issues at compile time — if it compiles, it's likely correct. The cost of skipping verification is runtime crashes on the TV.
# Compile shared-core for all targets (Kotlin multiplatform)
./gradlew :shared-core:compileKotlinAndroid
# Compile Android TV app (includes Compose compiler)
./gradlew :androidtv-app:compileDebugKotlin
# Full project compilation (use module-specific tasks to avoid ambiguity)
./gradlew :androidtv-app:compileDebugKotlin :shared-core:compileKotlinMetadata
Use :shared-core:compileKotlinAndroid after editing models/repositories — it's fast (10-20s) and catches type errors across the shared layer.
Use :androidtv-app:compileDebugKotlin after editing Compose screens — it runs the Compose compiler plugin which catches composable-specific errors.
# Android lint (catches common issues)
./gradlew :androidtv-app:lint
# Lint report location
# androidtv-app/build/reports/lint-results-debug.html
# Shared-core unit tests (contract tests for repositories)
./gradlew :shared-core:allTests
# Android TV instrumented tests (requires emulator)
./gradlew :androidtv-app:connectedDebugAndroidTest
@Composable invocations can only happen from the context of a @Composable functionCause: Calling a composable from a non-composable (lambda, regular function).
Fix: Mark the containing function or lambda as @Composable:
// WRONG
val items = list.map { item -> Text(item.title) }
// RIGHT
list.forEach { item ->
Text(item.title) // Already inside a @Composable context
}
Type mismatch: inferred type is Unit but ... was expectedCause: Compose content lambdas return Unit. If you're assigning the result of a composable call, that's wrong.
Fix: Composables are side-effects, not return values. Use state instead:
// WRONG
val text = Text("hello") // Text returns Unit
// RIGHT
Text("hello") // Just call it in the composition
None of the following functions can be called with the arguments suppliedCause: Often the wrong Surface import. androidx.tv.material3.Surface vs androidx.compose.material3.Surface have different signatures.
Fix: Use TV Surface for focusable containers:
import androidx.tv.material3.Surface // TV version with onClick
// NOT: import androidx.compose.material3.Surface
Unresolved reference: ExperimentalTvMaterial3ApiCause: Missing TV Material dependency.
Fix: Ensure build.gradle.kts has:
implementation("androidx.tv:tv-material:1.0.0-alpha10")
And opt-in at the function level:
@OptIn(ExperimentalTvMaterial3Api::class)
@Composable
fun MyTVComponent() { ... }
Modifier.focusRequester must be used with a FocusRequester that is remember'dCause: Creating FocusRequester without remember.
Fix:
val focusRequester = remember { FocusRequester() } // Always remember it
kotlinCompilerExtensionVersion mismatchCause: Compose compiler version doesn't match Kotlin version.
Fix: For Kotlin 1.9.24, use:
composeOptions {
kotlinCompilerExtensionVersion = "1.5.14"
}
Compatibility table: https://developer.android.com/jetpack/androidx/releases/compose-kotlin
Could not resolve / Failed to resolveCause: Missing repository or version conflict.
Check:
settings.gradle.kts has google() and mavenCentral() in repositories./gradlew dependenciesDuplicate class foundCause: Two dependencies provide the same class.
Fix: Add exclusion:
implementation("some:library:1.0") {
exclude(group = "conflicting.group", module = "conflicting-module")
}
Or use resolution strategy:
configurations.all {
resolutionStrategy {
force("conflicting.group:conflicting-module:1.0")
}
}
Cannot access class ... from moduleCause: Using a class from shared-core without proper module dependency.
Fix: Ensure androidtv-app/build.gradle.kts has:
dependencies {
implementation(project(":shared-core"))
}
Cause: Root and module build.gradle.kts declare different Kotlin versions.
Fix: Declare Kotlin version only in root build.gradle.kts:
plugins {
kotlin("multiplatform") version "1.9.24" apply false
kotlin("android") version "1.9.24" apply false
}
Modules reference without version:
plugins {
kotlin("android") // version comes from root
}
After editing shared-core models/services:
./gradlew :shared-core:compileKotlinAndroid && ./gradlew :shared-core:allTests
After editing Compose screens/components:
./gradlew :androidtv-app:compileDebugKotlin
After editing build.gradle.kts (dependencies):
./gradlew --refresh-dependencies :androidtv-app:assembleDebug
After major refactoring (full check):
./gradlew clean compileKotlin lint
Gradle output is verbose. Focus on:
e: file:///path/to/File.kt:42:15 Error message here
The e: prefix means error. The path and line number point to the exact issue. Ignore the hundreds of lines of task execution output above it.
Quick filter:
./gradlew :androidtv-app:compileDebugKotlin 2>&1 | grep "^e:"
assembleDebug for type checking. It's slower because it packages the APK. Use compileDebugKotlin for fast feedback../gradlew clean before every build. Only use clean when you suspect stale caches. It adds 30-60s for no benefit in normal development.