Still having trouble with getting Compose Preview ...
# compose-desktop
s
Still having trouble with getting Compose Preview annotation to resolve. Added the uiTooling implementation and compose-gradle-plugin:1.0.0-alpha1-rc1, all the stuff I found in the threads above.
1
a
The error in the stacktrace says:
Copy code
Caused by: org.gradle.api.GradleException: * Illegal version for 'Msi': '1.0' is not a valid version.
  * Correct format: 'MAJOR.MINOR.BUILD', where:
    * MAJOR is a non-negative integer with a maximum value of 255;
    * MINOR is a non-negative integer with a maximum value of 255;
    * BUILD is a non-negative integer with a maximum value of 65535;
  * You can specify the correct version using DSL properties: nativeDistributions.windows.msiPackageVersion, nativeDistributions.windows.packageVersion, nativeDistributions.packageVersion
This is not related to the preview. Native distributions have to follow OS specific versioning requirements. Here’s the relevant part of the docs https://github.com/JetBrains/compose-jb/tree/master/tutorials/Native_distributions_and_local_execution#specifying-package-version The easiest way to fix the error is to set
packageVersion = "1.0.0"
like here (or just not package into dmg, msi, etc…) https://github.com/JetBrains/compose-jb/blob/master/examples/widgets-gallery/desktop/build.gradle.kts#L31
Also we recommend to use
1.0.0-alpha3
instead of
1.0.0-alpha1-rc1
. With that version you don’t need to depend on
compose.uiTooling
.
compose.preview
is enough (also
compose.desktop.currentOs
already depends on
compose.preview
, so you don’t need to add a dependency for application modules, that already depend on
compose.desktop.currentOs
)
s
Cool, thanks finally got it working. Set
package = "1.0.0"
then updated to
1.0.0-alpha1-rc1
then kotlin to
Copy code
kotlin("jvm") version "1.5.21"
then changed
window {
to
Copy code
singleWindowApplication {
And вот оно!