Jetpack Compose on Kotlin 1.5.0
Update: androidx.compose.compiler:compiler:1.0.0-beta08
is released (June 2, 2021).
From this version, the expected version of Kotlin is 1.5.10
.
dependencies { implementation "androidx.compose.compiler:compiler:1.0.0-beta08"}android { buildFeatures { compose true } composeOptions { kotlinCompilerVersion "1.5.10" kotlinCompilerExtensionVersion "1.0.0-beta08" } kotlinOptions { jvmTarget = "1.8" }}
See more:
Compose compiler 1.0.0-beta07
is not supporting Kotlin 1.5.0
yet.
And I found that the changes of supporting Kotlin 1.5.0
have merged, but not released yet.
https://android-review.googlesource.com/c/platform/frameworks/support/+/1651538
For this moment, in my opinion, you should use 1.4.3
and wait for the next version (1.0.0:beta08
or 1.0.0
)
In the build.gradle file (project):
Change
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0"
To
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21"
In the build.gradle file (app):
composeOptions { kotlinCompilerExtensionVersion compose_version kotlinCompilerVersion kotlin_version }
compose_version will be 1.0.1
kotlin_version will be 1.5.21
This version (1.0.0-beta07) 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. Please fix your configuration (or
suppressKotlinVersionCompatibilityCheck
but don't say I didn't warn you!)
this version (1.0.0-beta08) of the Compose Compiler requires Kotlin version 1.5.10 but you appear to be using Kotlin version 1.4.31 which is not known to be compatible. Please fix your configuration (or
suppressKotlinVersionCompatibilityCheck
but don’t say I didn’t warn you!).
The version
1.0.0-beta07
requires Kotlin1.4.32
The version
1.0.0-beta08
requires Kotlin1.5.10