Kotlin "Unresolved reference: X" in CI
The Kotlin compiler found an identifier it cannot resolve to any declaration in scope. "e: Unresolved reference: X" marks the name and its location; the import or dependency that defines it is missing.
What this error means
Gradle compileKotlin fails with "e: /path/File.kt:(line): Unresolved reference: X" and "Compilation error" in the task summary.
kotlin
e: /app/src/main/kotlin/Main.kt: (5, 14): Unresolved reference: runBlocking
> Task :compileKotlin FAILEDCommon causes
A missing import for the symbol
The function, class, or property is declared elsewhere and the file never imports it, so the name is unbound.
The providing dependency is not declared
The symbol lives in a library not on the compile classpath, so no import can resolve to it.
How to fix it
Add the missing import
- Read the line and column in the
e:message. - Import the symbol from its package.
- Re-run the Gradle build to confirm it resolves.
Main.kt
import kotlinx.coroutines.runBlockingDeclare the dependency that provides it
When the symbol comes from a library, add it so the import target is on the classpath.
build.gradle.kts
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1")
}How to prevent it
- Let the IDE manage imports rather than typing them by hand.
- Declare every symbol-providing library in
dependencies. - Build locally so unresolved references surface before CI.
Related guides
Kotlin "warnings found and -Werror specified" in CIFix Kotlin "error: warnings found and -Werror specified" in CI - the compiler promoted warnings to errors via…
Kotlin kapt "error: cannot find symbol" in CIFix Kotlin kapt "error: cannot find symbol" in CI - an annotation processor referenced a class that was not g…
Kotlin "Could not resolve org.jetbrains.kotlin" in CIFix Gradle "Could not resolve org.jetbrains.kotlin:..." in CI - the build could not download a Kotlin artifac…