Closed AAverin closed 8 years ago
in hope that this was a bug because we have 2 modules in the app - ui and data, and only data module (android library) uses DBFlow.
But no luck, class is not regenerated, but app still breaks on second launch with an error that table is not connected to database
Caused by: com.raizlabs.android.dbflow.structure.InvalidDBConfiguration: Table: ...data.statistics.model.StatisticArticleModel is not registered with a Database. Did you forget the @Table annotation?
Sorry for confusion, class is still regenerated loosing database invocation even with DatabaseModules applied
Could this be some Google AutoService issue with Kapt?
What version of the gradle plugin are you using, which classes are used in kotlin and which are in Java?
Issue is present on both 1.5.1 and 2.0.0-beta6 All classes are in Kotlin
you cant write dbflow @Table
classes in Kotlin. There is some unexplained issue with KAPT.
Do you have any detailed information about this unexplained kapt issue? Maybe we could followup with some help from IntelliJ guys on this topic.
If not, what would be a proper solution then? We can't write dbflow classes in Java because we already use kapt for everything else and compiler complains if you try to use both apt plugin and kapt at the same time. Is there any way to use dbflow without annotations, for example?
you can still use KAPT, you just cant write DBFlow classes in Kotlin. Also you need to ensure stubs are enabled
Stubs are enabled, we are also using Databinding and Dagger2, so we need them.
Thanks, let me try converting classes to Java to check
Thanks, looks like the issue is resolved when writing databases and tables in Java classes. This is probably better to mention on the main page of dbflow+kotlin.
Also, I noticed that kotlinextensions are missing from the repo, at least my gradle was complaining about that and I had to remove them
yeah, both times I tagged the repo without pushing it. I will fix this in next beta. For now you can use the develop-SNAPSHOT
of the dbflow-kotlinextensions
project (it won't change that much unless more features requested in future). And next beta should include it as an artifact.
After
./gradlew clean
and building the project I see aGeneratedDatabaseHolder
class that creates my database. First run of the project everything is working correctly, but after re-compilation without cleanGeneratedDatabaseHolder
class is regenerated, and line that would create a database is no longer there, that breaks the project.We are using Kotlin + Dagger2 + Databinding, so lots of code-generation stuff