I noticed after enabling Android Compose for the project:
buildFeatures {
compose true
}
KSP with ROOM doesn't work properly finishing with exceptions like this during bulding project:
[ksp] [MissingType]: Element 'pl.softfly.multi_module_room.entity.Card' references a type that is not present - pl.softfly.multi_module_room.entity.Card
The problem occurs when the project is multi-module,
ROOM from the module cannot to find ROOM classes from the parent project. If compose true
is removed everything works as it should.
The project with Android Compose enabled (with exception): https://github.com/softfly/MultiModuleRoom/commit/de3f6bbd97cee282cf6f329c259dbcd6b6742666
The project with Android Compose disabled (works): https://github.com/softfly/MultiModuleRoom/commit/a5ce616bedfa438428b0ab1ce450e5eeee680474
Has anyone had a similar problem and was able to solve it?
I see a couple of issues:
You have the module dependencies backwards - the
app
module should haveand
roommodule
shouldn't reference theapp
module.You should also place all of the room entities/daos/database declarations inside the
roommodule
. Theapp
module should not have the room dependencies nor the KSP setup.I didn't look closer into the code, but I fixing the above will give a clean separation between room/compose, and I suspect will fix at least this issue.