https://kotlinlang.org logo
Title
k

kevindmoore

08/11/2021, 3:44 PM
I'm having a hard time using desktop compose in Android Studio. AS can't seem to find many classes even though I have the libraries as dependencies
Should I switch over to Intellij for desktop?
i

Igor Demin

08/11/2021, 4:17 PM
Android Studio has a very unpleasant issue at the moment, so, if your project is multiplatform project, I suggest to use IDEA. Desktop-only (not multiplatform) projects should work fine in Android Studio.
c

Colton Idle

08/11/2021, 4:52 PM
@kevindmoore I wonder if my message right before yours is related to this same thing.
k

kevindmoore

08/11/2021, 4:54 PM
I've had lots of issues. Finally got desktop compose to build but lots of missing references to classes
👍 2
I found really different results when creating projects from Intellij vs AS
a

Alexander Kurasov[JB]

08/12/2021, 9:06 AM
You mean different files from wizards or what?
k

kevindmoore

08/12/2021, 3:32 PM
So, Intellij did not produce all the files that AS did. gradlew file not there, gradle.properties was different and of course it did not produce android and iOS
👍 1
i

Igor Demin

08/12/2021, 6:06 PM
Different results/bugs because there are a lot of wizards/templates 🙂 : • Android Studio has its own wizard provided by Android Plugin which is developed by Google. • IDEA has its own wizard, but reuses some templates from Android Plugin (the same as in Android Studio, but the older version) • KMM Application template for Android Studio is the part of "Kotlin Multiplatform Mobile" plugin • Compose Template is the part of IDEA Kotlin plugin, and only visible in IDEA. Let's talk here only about Compose template and Compose-related IDE issues, as the others are out of scope of this chat. And let's distinguish wizard bugs (broken/missed files) and IDE bugs (red/underlined classes). The most of the IDE bugs because of instability of Kotlin MPP (it is still in Alpha). The development is painful when everything is broken in IDE, so we should do something about that. The first step to fix a bug is to have reliable reproducer. The second step is to let IDEA Kotlin Plugin developers know about that bug. We can let them know about it and create an issue in YouTrack, but if we don't have a reproducer, we can't do that. The third step is the most difficult. Developers should find time to fix that bug. The more people encounter it (it has a lot of likes in GitHub/YouTrack), the more it becomes a priority. The bugs in Compose Template are easier to fix, but we also need reliable way to reproduce them.
k

kevindmoore

08/12/2021, 6:31 PM
I am not too worried about template issues. I am more concerned that KMM and specifically, Desktop Compose doesn't work well. I still can't get it to compile
a

Alexander Kurasov[JB]

08/13/2021, 8:31 AM
Kevin, you have compilation issue only in AS or in Idea too?
i

Igor Demin

08/13/2021, 8:42 AM
Note, that compilation bugs and IDE bugs also two different things. We can compile/run project without any IDE. install Android app on device:
./gradlew installDebug
run desktop app:
./gradlew run
k

kevindmoore

08/13/2021, 2:58 PM
I'm currently getting a strange error of "...compileKotlinMetadata FAILED"
with it not being able to find imports
i

Igor Demin

08/13/2021, 3:02 PM
it means it can't compile
commonMain
. either something wrong in sources, or in
commonMain
dependencies (they don't have
common
part)
k

kevindmoore

08/13/2021, 3:58 PM
This is Compose code I've copied from Android. I've had to make some changes to work in Desktop. Seems weird that it doesn't fail in a regular compileKotlin task. Not sure what the MetaData task is doing that is different (I assume it is adding Kotlin Metadata to the classes?)