Detected multiple Kotlin daemon sessions at build/kotlin/sessions
This warning usually occurs when there are conflicting or duplicate Kotlin sessions running during the build process. The Kotlin daemon is responsible for caching and reusing compiled Kotlin code, which helps to improve the build performance. Having multiple daemon sessions can potentially lead to inconsistent build results and performance issues.
To resolve this issue, you can try the following solutions:
- Restart the build process: Stop the ongoing build and restart it. This will ensure that only a single Kotlin daemon session is started for that build.
-
Disable the Kotlin daemon: If the problem persists, you can disable the Kotlin daemon for your project. This will force Kotlin to start a new session for every build, but it can help in avoiding conflicts. To disable the Kotlin daemon, add the following line to your project’s
gradle.properties
file:kotlin.daemon=false
-
Clear the Kotlin daemon cache: In some cases, the Kotlin daemon cache may become corrupted or outdated, leading to conflicts. You can try deleting the cache directory manually to resolve the issue. The default cache directory is located at
~/.gradle/caches/jvm/{version}/kotlin-daemon
. Deleting this directory will force Kotlin to create a new daemon session during the build.
These steps should help in resolving the issue of multiple Kotlin daemon sessions. By ensuring that only a single session is active during the build, you can avoid conflicts and improve the stability and performance of your Kotlin build process.