'How to compile compose 1.1.1 with kotlin 1.6.20

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?



Solution 1:[1]

Here you can see compose and kotlin version mapping https://developer.android.com/jetpack/androidx/releases/compose-kotlin

1.2.0-alpha08 ->1.6.20
1.1.0-rc02 -1.2.0-alpha07 ->1.6.10

Solution 2:[2]

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

Solution 3:[3]

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'
  }
 ...
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 user2851150
Solution 2 Felix Kariuki
Solution 3 android_dev71