android-studiogradlesqldelight

How to solve error: "The IDE and Gradle versions of SQLDelight are incompatible, please update the lower version"


After quite accidentally updating the Gradle version and Android Studio version while programming an app with Kotlin, I ended up with the following error that shows up as a header inside my SQLDelight files:

The IDE and Gradle versions of SQLDelight are incompatible, please update the lower version.

The currently installed version of Android Studio is Android Studio Giraffe | 2022.3.1 Patch 1 (Build #AI-223.8836.35.2231.10671973, built on August 17, 2023) which seems to be compatible to SQLDelight, saying on the JetBrains plugin page that it's compatible to Android Studio — Flamingo | 2022.2.1 — Iguana | 2023.2.1 Canary 3 .

When I received the error stated above, I then tried to upgrade SQLDelight from 1.5.5 to 2.0.0 via my build.gradle (:app) and ended up in errors like

A problem occurred configuring root project 'TrampCompanion_BtmNav'. Could not resolve all files for configuration ':classpath'. Could not find com.squareup.sqldelight:gradle-plugin:2.0.0.

When I couldn't solve this, I rolled back the SQLDelight version to 1.5.5 and tried lowering the Gradle version for my project repeatedly - from 8.3 to 8.0, same for the Android Gradle Plugin Version, from 8.1.1 to 8.0.1 (via the project structure dialog).

Unfortunately, the error of IDE, Gradle and SQLDelight versions not matching persists. I hope somebody has a solution to this.


Solution

  • I was able to fix it (thanks to Reddit & own research): The developers of SQLDelight changed the package name/ artifact group for their plugin so I had to declare it as app.cash.sqldelight (rather than "com.squareup.sqldelight").

    After making additional changes to the build.gradle(:app) regarding property syntax, I had to change sourceFolders = ["AppDatabase", "migrations"] to srcDirs("AppDatabase","migrations"). After that, syncing the build.gradle worked fine.