Kotlin Error Messages
JVM and multiplatform language from JetBrains.All Kotlin pages
- Kotlin: error: unresolved reference 'x' (Unresolved reference: x)Kotlin unresolved reference means no visible declaration has that name: a typo, a missing import or a dependency not on the classpath. Fix it and sync Gradle.
- Kotlin: Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type String?Kotlin rejects a plain dot call on a nullable type like String?. Use ?. for a null result, ?: for a default, or check for null first so the value is smart-cast.
- Kotlin: Type mismatch: inferred type is String? but String was expectedKotlin type mismatch: a String? was used where String is required, or one type where another is expected. Handle null with ?: or a check, or convert explicitly.
- kotlin.UninitializedPropertyAccessException: lateinit property has not been initializedKotlin throws UninitializedPropertyAccessException when a lateinit var is read before assignment. Set it earlier, check ::x.isInitialized, or use by lazy.