Wire the ksp/kapt/BuildConfig task ahead of compileKotlin so generated symbols exist.
How to prevent it
Keep dependency configurations correct.
Import extensions explicitly.
Run ./gradlew compileKotlin on a clean checkout.
Frequently asked questions
What causes Kotlin "Unresolved reference" variant in CI?
There are 3 common causes: extension import missing, dependency in the wrong configuration, and generated symbol not built yet. Extension functions must be imported by their declaration package; without the import the receiver appears to lack the member.
How do I fix Kotlin "Unresolved reference" variant in CI?
There are 3 fixes depending on which cause you have: import the extension or symbol, move the dependency to the right configuration, and ensure generators run before compile. Work through them in order, since the first is the most common.
What does Kotlin "Unresolved reference" variant in CI actually mean?
The build fails with Unresolved reference: foo, pointing at the symbol.
How do I stop Kotlin "Unresolved reference" variant in CI happening again?
Keep dependency configurations correct. The prevention section lists 3 changes that keep it from recurring.