https://kotlinlang.org logo
#compose-desktop
Title
# compose-desktop
a

Anders Carlsen

11/27/2023, 5:03 PM
hi, anybody using ormlite in an compose desktop application and have success making a release build? with the following code it works fine in debug and even with runDistributable, but if I choose packageReleaseDmg for example the code hangs on connectionSource.getReadWriteConnection(“”) line - if i disable proguard it works, all ormlite/jdbc packages I can find to be used has been excluded in proguard config file
Copy code
val dbFolder = File(applicationFolder, DesktopConfiguration.DATABASE_FOLDER_NAME)
        dbFolder.mkdirs()

        val dbFile = File(dbFolder, DesktopConfiguration.DATABASE_NAME)
        val dbConnectionString = "jdbc:sqlite:${dbFile.absolutePath}"
        connectionSource = JdbcConnectionSource(dbConnectionString)

        val conn = connectionSource.getReadWriteConnection("")
        val dbVersion = conn.queryForLong("PRAGMA user_version;")
        Logger.i(TAG, "Database filesystem path: ${dbFile.absolutePath}")
        Logger.i(TAG, "Database current version: $dbVersion")
k

Kirill Grouchnikov

11/27/2023, 5:26 PM
Doesn’t sound like a Compose question, but rather an ormlite / proguard configuration question that perhaps is better suited to ask at ormlite forums or stack overflow
Something like https://proguard-rules.blogspot.com/2017/05/ormlite-proguard-rules.html or maybe a bit more current would be relevant
a

Anders Carlsen

11/27/2023, 5:40 PM
you are probably right, just for reference I found my answer here: https://github.com/JetBrains/compose-multiplatform/issues/2668 I needed to add -keep class org.sqlite.** { *; } to proguard config file
👍 2
in addition to ormlite rules
2 Views