How to compile compose 1.1.1 with kotlin 1.6.20

Viewed 3075

Ive got a error like this while building my project:

e: This version (1.1.1) of the Compose Compiler requires Kotlin version 1.6.10 but you appear to be using Kotlin version 1.6.20 which is not known to be compatible. Please fix your configuration (or suppressKotlinVersionCompatibilityCheck but don't say I didn't warn you!).

I'm using the newest IntellIJ Pro, and the newest kotlin

How i can make the compose compile with the project?

5 Answers

You need to use kotlin version 1.6.10 to compile project with this version of compose. In next releases may be thay add new version of kotlin support. Change your gradle/maven properties to solve this problem.

In Gradle change:

kotlin("jvm") version "1.6.20"

to:

kotlin("jvm") version "1.6.10"

Or you can add compiler args (But there may be problems):

"-P", "plugin:androidx.compose.compiler.plugins.kotlin:suppressKotlinVersionCompatibilityCheck=true"

for kotlin version 1.6.20 you need to add this line in your build.gradle

 composeOptions {
    kotlinCompilerExtensionVersion '1.2.0-alpha08'
}

Refer to this documentation by google to find out more about kotlin compatibility to different compose versions

Following the compatibility table posted by user2851150 above,https://developer.android.com/jetpack/androidx/releases/compose-kotlin, it works for me setting in build.gradle (module) :

android{
 ...
  composeOptions {
    kotlinCompilerExtensionVersion '1.1.1'
    kotlinCompilerVersion '1.6.10'
  }
 ...
}

Go to the build.gradle in project level and change the kotlin version to mapped the required and compatible version

Related