This version (1.0.0-beta06) of the Compose Compiler requires Kotlin version 1.4.32 but you appear to be using Kotlin version 1.4.30 which is not known to be compatible.

こんにちは。

Jetpack Composeを試そうとした際にビルドエラーが出たときの対処です。

This version (1.0.0-beta06) of the Compose Compiler requires Kotlin version 1.4.32 but you appear to be using Kotlin version 1.5.0 which is not known to be compatible.

ComposeのコンパイラはKotlinの1.4.32を使用しなければいけないのに、1.5.0を使っているから駄目だというかんじですね。

あれ、KotlinのVersionってどこで指定するんだっけ?

結論

プロジェクトのbuild.gradleに下記を追加すればよいです。

buildscript {
    dependencies {
        classpath "com.android.tools.build:gradle:7.0.0-alpha15"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.32" // これを追加
    }
}

感想

Kotlinは結局Gradleのプラグインとしてダウンロードされているのですね。。。これで簡単にKotlinのバージョンを指定できるようになりました。