JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.73k stars 1.14k forks source link

How can I develop compose-multiplatform projects using Intellij IDEA. #4224

Open Zeng1998 opened 6 months ago

Zeng1998 commented 6 months ago

Describe the bug How can I develop compose-multiplatform projects using Intellij IDEA.

I use Intellij IDEA to open the project from Kotlin Multiplatform Wizard. Everything work well except the android app.

Affected platforms Select one of the platforms below:

Versions

To Reproduce Download from Kotlin Multiplatform Wizard and open using IDEA.

Expected behavior Using IDEA to develop desktop, wasm and android projects.

Screenshots

image

looks like that the android app module is not detected.

image

no syntax highlight and no run configuration.

mazunin-v-jb commented 6 months ago

Hello, @Zeng1998! The problem may be that Android Plugin is disabled in your settings. Could you please check if it is enabled? Follow Settings -> Plugins (in the menu bar on the left side) -> Installed (right tab on the appeared screen).

Zeng1998 commented 6 months ago

Hello, @mazunin-v-jb , thanks your reply. I have made some retries and now there is something new.

I download a new project generated by https://kmp.jetbrains.com and open in IDEA directly. It contains Android, Desktop, and WASM.

Now, all modules are accurately detected. But there are still some that confuse me.

image

  1. For the desktop app, it's easy to run by just opening main.kt and clicking the 'run button'.

image

  1. For the WASM app, I open main.kt but there is no 'run button'. Is this because IDEA has not yet supported this experimental feature? Of course, I can find the corresponding running command in Gradle.

image

image

  1. For the Android app, I open MainActivity.kt and there is no 'run button' either. But I can find a run configuration named 'composeApp' in the IDEA.

image

image

Overall, I can run all the apps so far, but it still looks a bit complicated and may require a clearer understanding of the Gradle configuration files for me.