Type of the parameter must be a class annotated with @Entity or a collection/array of it Type of the parameter must be a class annotated with @Entity or a collection/array of it android android

Type of the parameter must be a class annotated with @Entity or a collection/array of it


I was getting same error for

@Insertfun insertCars(vararg cars: List<Car>)

I fixed it by removing vararg

@Insertfun insertCars(cars: List<Car>)


To anyone having the issue: Type of the parameter must be a class annotated with @Entity or a collection/array of it

This error is an indication that a Dao utilizing the BaseDao does not have a valid class for that datatype. For example here In this code the DataDao defines that class datatype to be used is type "Data" (line 23 of DataDao.kt) which is defined by the Data.kt class that contains the @Entity tag (line 22 of Data.kt).

So... if you are encountering this error, the error is NOT originating from the BaseDao interface but rather the Dao(s) that are using BaseDao.

I hope this helps!