https://kotlinlang.org logo
Title
n

natario1

04/25/2021, 4:56 PM
Is it possible to work on compose desktop through Android Studio? I'm trying to setup a hello world app but running into several issues like this one . I think I should specify the correct JDK but Android Studio does not seem to have the handy JDK version dropdown in Project Structure.
o

Olivier Patry

04/25/2021, 5:12 PM
That what I do, with Android Studio 4.1 or Canary
you can check the Gradle setup here: https://github.com/opatry/compose-tiles-anim I think I used this from inspiration of https://github.com/joreilly/PeopleInSpace
n

natario1

04/25/2021, 5:28 PM
Did you have to specify JDK 11 somewhere? I can't see anything special in your configuration
o

Olivier Patry

04/25/2021, 5:30 PM
I did in my Android Studio launch configuration by hand
n

natario1

04/25/2021, 5:40 PM
I see, thanks! Didn't fix my issues unfortunately.
Window
function is still red because it can't find BufferedImage in the classpath, running the configuration does nothing, I also get
Caused by: org.jetbrains.skiko.LibraryLoadException: Cannot find libskiko-macos-x64.dylib.sha256, proper native dependency missing.
when manually calling the
run
task. Big mess
🤔 1
o

Olivier Patry

04/25/2021, 5:55 PM
Did you use
kotlin(jvm)
plugin and
implementation(compose.desktop.currentOs)
dependency in your app module?
n

natario1

04/25/2021, 6:36 PM
Thanks, the currentOs helped! Now I can manually call the
run
task and the app runs. Still weird IDE behavior,
Window
is red and creating a run configuration like yours does nothing
c

Chris Sinco [G]

04/25/2021, 11:47 PM
Android Studio does not seem to have the handy JDK version dropdown in Project Structure.
This setting moved in Arctic Fox
👍 1
o

olonho

04/26/2021, 8:23 AM
AS support for Kotlin multiplatform have to be improved somewhat, so better use IDEA for now
o

Olivier Patry

04/26/2021, 9:11 AM
@Chris Sinco [G] you can have JDK version dropdown from project structure in 4.1.3 Right click > Open Module Settings > Project Settings : Project > Project SDK : Edit From here you can choose among available one or add one (+ button) from download or disk
(Or more directly Open Module Settings > Platform Settings : SDKs)
n

natario1

04/26/2021, 1:18 PM
Yeah can't see this ^ in Arctic Fox. Might also depend on whether an Android module is detected, not sure. Anyway I was able to use the setting shown by Chris above. Though it doesn't solve
Window
being red
c

Colton Idle

04/26/2021, 2:57 PM
Unfortunately having compose for Android and desktop is in a weird state right now. Enabling compose in an existing Android app pushes you to use Gradle 7, and agp 7+, but Compose desktop does not work. Hope that compose, jb compose, Gradle 7, ago 7, and kotlin 1.5 all play well soon.
1
j

Javier

04/28/2021, 7:17 AM
@Colton Idle you have to use Jetbrains compose in the android app, so you can use AGP 4
c

Colton Idle

04/28/2021, 4:33 PM
@Javier yeah but I want to use agp 7 and gradle 7 because of some of the improvements.
j

Javier

04/28/2021, 4:35 PM
You can use Gradle 7 with AGP 4. I think the real problem is the binary compatibility, hope it is resolved soon