Issue
I'm using room database for android. It was working fine until I updated to Kotlin 1.7.0 recently. Now I get the following error:
Each bind variable in the query must have a matching method parameter. Cannot find method parameters for :limit, :offset.
Here is my dao:
@Query("SELECT * FROM eventdata ORDER BY id ASC LIMIT :limit OFFSET :offset")
fun allEvents(limit: Int, offset: Int): List<EventData>
Here my build.gradle
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
.
.
.
implementation "androidx.room:room-runtime:2.4.2"
kapt "androidx.room:room-compiler:2.4.2"
When I downgrade Kotlin to 1.6.21 it works fine. Is this a Kotlin Bug or am I doing something wrong?
Solution
Upgrading "androidx.room..." to 2.4.3 worked for me
Answered By - Michał Kaźmierczak
Answer Checked By - Pedro (JavaFixing Volunteer)