Explicit API Mode
The explicitApi property enables Kotlin's Explicit API mode, which enforces visibility modifiers and return type declarations on all public API members.
Default
explicitApi is enabled by default (true) in Kreate.
Configuration
kreate {
platform {
explicitApi = true // default
}
}
To disable it for application modules or internal projects:
kreate {
platform {
explicitApi = false
}
}
What It Enforces
When enabled, the Kotlin compiler will emit errors for any public declaration that is missing:
An explicit visibility modifier (
public,internal,private)An explicit return type on functions and properties
Example
// ❌ Fails with explicitApi = true
fun greet() = "Hello"
// ✅ Correct
public fun greet(): String = "Hello"
25 April 2026