概要
以下のように怒られたのでメモ。
e: Daemon compilation failed: Could not connect to Kotlin compile daemon
原因
以下で説明されているように、Compose Compiler と kotlin のバージョンに互換性が無かった。
exception: error: this version (1.3.2) of the Compose Compiler requires Kotlin version 1.7.20 but you appear to be using Kotlin version 1.8.20 which is not known to be compatible. Please fix your configuration (or `suppressKotlinVersionCompatibilityCheck` but don't say I didn't warn you!).
対応
Compose to Kotlin Compatibility Map を参照して Compose Compiler Version と Kotlin Version の組み合わせを一致させる。
上記の場合、Compose Compiler Version と Kotlin Version の 1.3.2 と 1.7.20 という組み合わせに互換性がなかったわけなので、以下のように Compose Compiler Version を 1.4.6 に上げるか、kotlin のバージョンを 1.7.20 に変更する必要がある。
kotlinCompilerExtensionVersionの設定例
android {
composeOptions {
kotlinCompilerExtensionVersion = "1.4.6"
}
}