Can anyone please help with the following issue co...
# kotlin-native
r
Can anyone please help with the following issue coming with sqldelight
Copy code
Execution failed for task ':compileSqlDriverNativeMainKotlinMetadata'
w: library included more than once: /Users/rahulrawat/.konan/kotlin-native-prebuilt-macos-x86_64-1.5.31/klib/common/stdlib
w: Could not find "co.touchlab:sqliter-driver-cinterop-sqlite3" in [/Users/rahulrawat/Desktop/Projects/kmp/AddressLibrary, /Users/rahulrawat/.konan/klib, /Users/rahulrawat/.konan/kotlin-native-prebuilt-macos-x86_64-1.5.31/klib/common, /Users/rahulrawat/.konan/kotlin-native-prebuilt-macos-x86_64-1.5.31/klib/platform/ios_arm64]
Tried reverting to 1.5.2 of sqlDelight and kotlin 1.5 but nothing seems to be working.
k
You'd need to post a lot more of your config. What Kotlin version? What sqldelight version? How are they set up? It's not finding sqliter's cinterop, which is quite odd (I maintain that, just FYI). It should all be pulled in automatically.
r
Hi Kevin, So following is my build gradle file and i am currently using kotlin 1.6 with sqlDelight 1.5.3 with the native sql driver shared among iOS and the native targets
k
Ah, you've got a hierarchical source set/"metadata" issue. The task that's failing it
compileSqlDriverNativeMainKotlinMetadata
. Check that you have "granular source sets" enabled in
gradle.properties
, then you might also need some others. And make sure it's the latest Kotlin you can support. Sqldelight should support hierarchical, but I haven't used that in a prod app yet.
Copy code
kotlin.mpp.enableGranularSourceSetsMetadata=true
kotlin.native.enableDependencyPropagation=false
kotlin.mpp.enableCInteropCommonization=true
If those aren't in your
gradle.properties
, then that's why it's not working. If they are, but not that last one, try adding that, although I think that's only needed if you're using cinperop directly (but I'm not 100% sure).
r
Tried it the last line was the only one that wasn’t added. Still the same issue
So I found out the issue that was causing compilation to fail was that I didn’t update the multiplatform and serialisation plugin’s version. Now it compiles fine but the warning
Copy code
Could not find "co.touchlab:sqliter-driver-cinterop-sqlite3"
still remains
k
Not sure, tbh. It may be that we don't have 1.6.x published versions of sqliter and sqldelight, and this warning is a weird artifact of how the metadata compiling works. If it compiles, then this isn't a blocker, and the warning may be gone when there are 1.6.x versions published. Hard to say. However, if it compiles and runs, the code is for sure finding that library where it needs it (I.E. the non-metadata builds)
r
Ok. Thanks Kevin for taking the time in helping me 😄
195 Views