0

I have used Ktor JVM Client for doing network calls in Compose for Desktop Application.

Network calls are working fine in Debug build means when I am just running the application it's working fine.

But when I create the EXE distribution file, by executing the packageExe task in Gradle, it's creating an EXE file. I have installed it on my machine. Then I am running the application and I am seeing that network calls are not working. I have checked internet is working properly.

Please provide a solution to fix this issue. Thanks in advance.

Avijit Karmakar
  • 8,890
  • 6
  • 44
  • 59
  • Could you please describe more precisely what the problem is? It will be hard to help with so little to go with. – Joffrey Jun 06 '21 at 18:03
  • Show some code, maybe artificially added. The difference between both runs could be many. Packed as exe/jar the file resource names are case sensitive - so if you copy from resources... And so on. – Joop Eggen Jun 06 '21 at 18:18
  • *network calls are not working* - but what is the symptom? Runtime errors? Nothing happens? – Joffrey Jun 06 '21 at 18:56

1 Answers1

3

Your question doesn't leave any details about the failure type (compile error? runtime exception? Empty data? etc.).

But if I had to speculate based on such limited information, I'd guess it's probably this: https://github.com/JetBrains/compose-jb/issues/429

Specifically, when packaging, you need to specify which JVM modules you want to be packed into your distributable app, and likely you are missing your crypto module. Try something like this:

compose.desktop {
    application {
        mainClass = "MainKt"
        nativeDistributions {
            modules("jdk.crypto.ec")

            targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
            packageName = "untitled"
        }
    }
}
JIm
  • 236
  • 1
  • 2