Hello guys! I am encountering an error with Room...
# android
j
Hello guys! I am encountering an error with Room Database when using Kotlin 1.7.0 but if I downgrade my Kotlin version to 1.6.21, everything works fine. This is the error:
Copy code
error: Query method parameters should either be a type that can be converted into a database column or a List / Array that contains such type. You can consider adding a Type Adapter for this.
    kotlin.coroutines.Continuation<? super java.lang.Integer> continuation);
and this is the DAO Query throwing the error:
@Query("""
SELECT COUNT(*) FROM enrolment
""")
suspend fun getEnrolmentCount(): Int?
k
Update your Room dependency too
☝️ 1
k
j
My room version is the latest.
Copy code
implementation "androidx.room:room-runtime:2.4.2"
kapt "androidx.room:room-compiler:2.4.2"
k
Correct me if I’m wrong, but is nullable integer necessary here as you should receive 0 if the table is empty? Maybe try using non-nullable integer as the return type.
j
@Krystian Demidiuk I have tried that but it is not the issue a the moment
w
@Joe Altidore Updating to
2.5.0-alpha02
fixed the issue for me.
j
@Wesley Jonathan Marcolino Thanks for the solution. It worked for me.
🙌 1
Thanks everyone for your contributions