I’m encountering an error when generating a releas...
# compose-desktop
y
I’m encountering an error when generating a release build of my desktop app:
Could not create instance of:
This seems tied to SQLDelight worker configuration
Copy code
single {
    val driver = JdbcSqliteDriver(JdbcSqliteDriver.IN_MEMORY)
.also { LlmsDatabase.Schema.create(it) }
.apply { enableForeignKeys() }
LlmsDatabaseWrapper(driver, LlmsDatabase(driver))
}
This worked fine in debug builds but failed in release. What I Tried Following guidance from this Koin issue , I modified the code to use a persistent database with a cache directory:
Copy code
val appCacheDirectory = appCacheDirectory(appId = "org.yassineabou.llms", createDir = true)
val driver = JdbcSqliteDriver(url = "jdbc:sqlite:$appCacheDirectory/LlmsDatabase.db", schema = LlmsDatabase.Schema).apply {
enableForeignKeys()
}
LlmsDatabaseWrapper(driver, LlmsDatabase(driver))
However, the error persists in release builds. For more information check out my repository: https://github.com/yassineAbou/LLMS
a
You probably need to add
modules(javax.sql)
to nativeDistrubution
y
I added that to nativeDistribution. I just forgot to mention it
a
Try to find the rest of the exception text
☝️ 1
☝🏻 2
j
+1 for finding the rest. This looks like the top line of the Koin exception, but further down it will tell exactly why it can't create this VM
y
after checking the full exception text. I got this exception:
java.sql.SQLException
– No driver matches the JDBC URL
jdbc:sqlite
How can I resolve this issue?
a
Probably need to configure proguard to not remove it.
1
y
You're right. Adding this ProGuard rule fixed the issue:
-keep class org.sqlite.** { *; }