yahoo / squidb

SquiDB is a SQLite database library for Android and iOS
https://github.com/yahoo/squidb/wiki
Apache License 2.0
1.31k stars 132 forks source link

Does not supported in kotlin lang #278

Closed DraculeaIV closed 7 years ago

DraculeaIV commented 7 years ago

Showes Unresolved reference: xxxxx while building.Till now ,I failed to find a way to solve it, so I use java again.

sbosley commented 7 years ago

Can you please provide some more detail? Are you seeing issues with code generation, or with calling the core squidb dependency from a Kotlin class? We're not using Kotlin ourselves so I can't be sure, but I believe that Kotlin projects need to be configured differently for code generation than Java projects, so if you're having problems with generated models it could be related to that. Some sample code demonstrating the problem would be helpful!

MiguelAngelLV commented 7 years ago

I use it with Kotlin without problems. The version 4.0 add nullability and It integrate perfect with kotlin.

I only write in java the models.

DraculeaIV commented 7 years ago

reply to @sbosley Yes, these generated model files reported Unresolved reference while building,these core dependencies works well.These error log located to import line,such as import com.example.db.MyTable and shows errror Unresolved reference:MyTable.If I deleted these generated files from build folder,they cannot be regenerate if I use kotlin.

reply to @MiguelAngelLV well I used 3.2.3,so I'll try 4.0 now.

sbosley commented 7 years ago

@DraculeaIV Did you update your build.gradle file to use kapt instead of annotationProcessor for code generation? And are you keeping your model specs written in Java as @MiguelAngelLV suggested?

Also just be aware that 4.0 is currently in beta -- no known bugs, but the API may change slightly between now and a final release.

DraculeaIV commented 7 years ago

@sbosley Finally succeeded by using kapt! Version 3.2.3 is also available in this mode.Model specs written in kotlin are also succeeded in building.