I made a multiplatform app targeting android and i...
# multiplatform
o
I made a multiplatform app targeting android and ios. Now I want to expand the target to desktop. How do I generate a desktopMain for my project šŸ¤”
t
in the
kotlin
block, add a jvm target with the name desktop like so:
jvm("desktop") { /* configuration goodies */ }
which will automatically add a ā€œdesktopMainā€ source set to your hierarchy.
o
Does it automatically generate the main entry file for desktop app?
a
No, it does not automatically generate the main entry file. This helps you configure it
m
Just go to the wizard and generate a new project with desktop support. You can then copy/paste the newly generated pieces into your existing project.
ā¤ļø 1
ā˜ļø 1
ā˜šŸæ 1
o
There should be a gradle or KMP plugin command for this. I think flutter has this feature
āž• 5
s
expect/actual can now generate the files in the right places, so why not?
d
Yeah features like that are really helpful. Gradle configurations are difficult to figure out from scratch and getting harder as there’s been so many changes over the years, making it to hard to find the exact syntax you need for a specific type of project in 2025.
šŸ‘ 2
t
Generation is great to get started, but you will always need to understand what the build script is doing at some point. Fortunately, the migration and upgrade warnings have improved since the early days, so if you keep up-to-date with each new release, just running gradle will usually tell you what needs to change. Upgrading across multiple versions can be painful, but there are always docs; although I understand the pain of needing to read through almost all the docs each time since there are often many changes.
šŸ‘ 2