1

I made a Kotlin Multiplatform Mobile project using android studio and ran into the following error after importing SQLDelight:

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

I followed this question, however everything they mentioned I had already done correctly. After going file by file and failing to find where I had declared that version I decided to compare my project to one of the sample projects.

After going through the files again I found that I was using sqlDelightVersion 1.5.2 in my App grade.properties and they used 1.4.2 After changing it from 1.5.2 to 1.4.2 everything compiles.

Question is, why would something like this happen if SQLDelight has nothing to do with jetpack compose?

barryalan2633
  • 610
  • 7
  • 21
  • You might wanna edit the last line of the second last paragraph, the version numbers – Richard Onslow Roper Oct 19 '21 at 04:56
  • 1
    most probably SQLDelight forces kotlin version to `1.5.30`, while compose `1.0.1` requires kotlin `1.5.21`. Update you compose to latest version which is `1.0.4` – Phil Dukhov Oct 19 '21 at 06:36
  • I did just that which produced the same error but know saying it requires 1.5.31 and that I am using 1.5.30 which was still coming from DQLDelight since my Kotlin version was actually 1.5.21 but once I changed 1.5.21 to 1.5.31 that was solved too. Thanks for answering my questions. – barryalan2633 Oct 19 '21 at 07:27

1 Answers1

1

Jetpack Compose is tightly bound to kotlin compiler version and it probably won't change soon (although, AFAIK, Google is talking to Jetbrains about stabilizing compiler plugin APIs for that NOT to happen. My source on that is a one of the Q&As with compose team).

If you want to use SQLDelight or any other library that is based on some other version of kotlin - you probably have to force proper kotlin version on gradle level (like here)

Jakoss
  • 4,647
  • 2
  • 26
  • 40
  • Any idea why Compose even need a Kotlin compiler plugin? – Cristan Dec 06 '21 at 12:50
  • The whole premise of compose syntax is based on kotlin compiler magic. It's a huge topic in itself. TLDR: kotlin compilar is the reason why we can use compose as simple functions and it just works – Jakoss Dec 06 '21 at 13:15