compose-multiplatform icon indicating copy to clipboard operation
compose-multiplatform copied to clipboard

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

Open Zeng1998 opened this issue 1 year ago • 2 comments
trafficstars

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:

  • All

Versions

  • Kotlin version*: 1.9
  • Compose Multiplatform version*: 1.6
  • OS version(s)* (required for Desktop and iOS issues): Windows 11
  • OS architecture (x86 or arm64): x86
  • JDK (for desktop issues): JDK 21

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.

Zeng1998 avatar Feb 03 '24 07:02 Zeng1998

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).

mazunin-v-jb avatar Feb 05 '24 12:02 mazunin-v-jb

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.

Zeng1998 avatar Feb 06 '24 04:02 Zeng1998