Leandro Borges Ferreira
01/09/2025, 1:14 PMcommonMain
folders of my modules and it works just fine with the android app... but when I try to build the iOS app, if throws this error:
> Task :application:core:persistence_room:kspKotlinIosSimulatorArm64 FAILED
note: [ksp] loaded provider(s): [androidx.room.RoomKspProcessor$Provider]
error: [ksp] Entities and POJOs must have a usable public constructor. You can have an empty constructor or a constructor whose parameters match the fields (by name and type).
Tried the following constructors but they failed to match:
<init> -> [param:id -> matched field:unmatched, param:title -> matched field:unmatched, [i'm hidding the parameters here] - [hidden].document.DocumentEntity
error: [ksp] Entities and POJOs must have a usable public constructor. You can have an empty constructor or a constructor whose parameters match the fields (by name and type). -
Does anyone had this problem already? How did you solve it?Corrado Quattrocchi
01/16/2025, 4:44 PM:shared
---- :database
-------- AppDatabase
-------- Dao1
-------- Dao2
-------- etc...
:feature
---- :database
-------- FeatureDao
---- :model
-------- FeatureModel
In the initial setup of the db I put everything under :shared:database
, but I decided to move things into their own feature module (also daos and db models). So now I just add projects.feature.database
as a dependency in the projects.shared.database
module to keep things separated.
Like you said on android everything works well, but when I try to run the iOS app I get the same error.
After many attempts I resolved this by duplicating FeatureDao
and FeatureModel
inside projects.shared.database
module and use those in my `AppDatabase`class instead of the one in projects.feature.database
.
I don’t like this setup because everything is mixed up and it slows down the builds when I want to change something of Feature1 which is unrelated to Feature2. I’ll let you know if I find a proper solution, but for now you may want to put in one module the daos, models and the database class.Leandro Borges Ferreira
01/16/2025, 5:40 PMLeandro Borges Ferreira
01/16/2025, 5:41 PMLeandro Borges Ferreira
01/16/2025, 5:41 PMLeandro Borges Ferreira
01/16/2025, 5:41 PMCorrado Quattrocchi
01/16/2025, 5:44 PMCorrado Quattrocchi
01/16/2025, 5:44 PMLeandro Borges Ferreira
01/16/2025, 5:49 PMCorrado Quattrocchi
01/17/2025, 1:56 PM