Pablo
01/16/2025, 7:32 PMStan van der Bend
01/16/2025, 7:41 PMcreateDistributable
gradle task (which produces the binaries in ${project.buildDir}/compose/binaries
), but this doesn't create a fully bundled application packaged into an exe (afaik).
For this option make sure to specify the target format:
compose.desktop {
application {
nativeDistributions {
targetFormats(TargetFormat.Exe)
}
}
}
In order to do that I highly recommend to use conveyor, they make it easy peasy to create native distributions that comes with an app installer and automatic update support.Pablo
01/16/2025, 7:47 PMPablo
01/16/2025, 7:47 PMPablo
01/16/2025, 7:48 PMcreateDistributable
gradle task"Pablo
01/16/2025, 7:48 PMPablo
01/16/2025, 7:48 PMPablo
01/16/2025, 7:48 PMStan van der Bend
01/16/2025, 7:49 PMPablo
01/16/2025, 7:50 PMPablo
01/16/2025, 7:50 PMStan van der Bend
01/16/2025, 7:51 PMStan van der Bend
01/16/2025, 7:51 PMPablo
01/16/2025, 7:52 PMPablo
01/16/2025, 7:53 PMPablo
01/16/2025, 7:53 PMPablo
01/16/2025, 7:54 PMPablo
01/16/2025, 7:54 PMChrimaeon
01/16/2025, 7:55 PMThe plugin simplifies the process of packaging applications into native distributions usinghttps://www.jetbrains.com/help/kotlin-multiplatform-dev/compose-native-distribution.html#gradle-pluginand running an application locally. Distributable applications are self-contained, installable binaries that include all the necessary Java runtime components, without requiring a JDK to be installed on the target system.jpackage
Stan van der Bend
01/16/2025, 7:58 PMPablo
01/16/2025, 8:03 PMFailed to check JDK distribution: 'jpackage.exe' is missing
I think that it's because the embedded jdk in Android Studio doesn't contain all the stuff necessary for doing this. I'm searching for a standalone open jdk to solve this. After the dinner I'll try. Thank you.Pablo
01/16/2025, 9:23 PMStan van der Bend
01/16/2025, 10:28 PMPablo
01/16/2025, 11:01 PMPablo
01/16/2025, 11:02 PMTo reduce the distributable size, the Gradle plugin uses jlink that helps bundle only the necessary JDK modules.
For now, the Gradle plugin does not automatically determine necessary JDK Modules.
Pablo
01/16/2025, 11:02 PMPablo
01/16/2025, 11:02 PMPablo
01/16/2025, 11:03 PMMichael Paus
01/16/2025, 11:14 PMPablo
01/17/2025, 7:26 AMPablo
01/17/2025, 7:27 AMPablo
01/17/2025, 7:28 AMcompose.desktop {
application {
mainClass = "com.helper.MainKt"
buildTypes.release.proguard {
obfuscate.set(true)
}
nativeDistributions {
targetFormats(TargetFormat.Msi, TargetFormat.Exe)
packageName = "Helper"
packageVersion = "1.0.0"
}
}
}
When I execute .\gradlew createDistributable
only a folder with the .exe file is created, but I can't find any .msi file anywhere. I also tryed removing TargetFormat.Exe and letting only TargetFormat.Msi with same result.Michael Paus
01/17/2025, 9:05 AM.\gradlew packageDistributionForCurrentOS
instead. This will create all configured targetFormats. (Maybe restrict yourself to MSI here.)
3. Once everything works you should switch to .\gradlew packageReleaseDistributionForCurrentOS
. Thatâs where ProGuard kicks in and tries to reduce the bundle size. But donât try that before everything else works.
You will find the installer as a single file under YourApp/composeApp/build/compose/binaries/main/msi
Pablo
01/17/2025, 10:12 AMPablo
01/17/2025, 10:13 AMMichael Paus
01/17/2025, 10:45 AMPablo
01/17/2025, 10:47 AMMichael Paus
01/17/2025, 10:48 AMPablo
01/17/2025, 10:48 AMMichael Paus
01/17/2025, 10:50 AMMichael Paus
01/17/2025, 10:50 AMPablo
01/17/2025, 10:50 AMPablo
01/17/2025, 10:50 AMPablo
01/17/2025, 10:50 AMPablo
01/17/2025, 10:51 AMPablo
01/17/2025, 10:51 AMPablo
01/17/2025, 10:51 AMMichael Paus
01/17/2025, 10:52 AMPablo
01/17/2025, 10:52 AMPablo
01/17/2025, 11:35 AMPablo
01/17/2025, 11:36 AMapp.preferences_pb
file on appdata and it works, but if I create a distributable installer and install it, then, i see that it creates a temp file called app.preferences_pb.tmp
but that file has 0 bytes and datastore is not storing or retrieving any valuesPablo
01/17/2025, 11:36 AMPablo
01/17/2025, 11:57 AM