-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot run compose desktop application using IDEA gutter #3123
Comments
I investigated the issue a little bit and found that skiko loads libraries manually here And Compose Gradle plugin provides all necessary resources, but when running from IDEA doesn't. I don't know why it works fine with jvm only cases (without kotlin("mutliplatform") only kotlin("jvm")). Only noticed that with "jvm" plugin skiko-awt-runtime is provided as a runtime dependency but with "multiplatform" it is not |
I've just run into this issue on Windows. I used the "play" button to run the app which causes the error:
Executing the The "play" button also works if I remove the
line from Related conversation: https://kotlinlang.slack.com/archives/C01D6HTPATV/p1683708168775229 |
Besides, none of my "Kotlin application" run configurations work, not only the Compose/Desktop related ones :( |
Ok, I reviewed the current Situation and created the following issue on YouTrack: Generally, I take this issue very seriously. The proposal will hopefully fix more issues with unreliable run-gutters. Please let me know if you have any objections or suggestions for improvement. |
This may be a little late, but I had this issue too a while ago. So I looked into the documentation of Skiko itself and found out that they suggest manually importing it the following way (the "version" may differ):
I simply put this into the following:
but I think this also works when you just put it outside of it. But the implementation has to be in the 'dependencies {}' of course 😄 . This solution solved the problem perfectly for me. I also tried to change 'implementation(compose.desktop.currentOs)' to 'implementation(compose.desktop.macos_arm64)' but it didn't fix it for me. Hope this helps :) |
Please upgrade IntelliJ and Kotlin instead and report back if this works for you 👍 |
I have spent lots of time on this, but at least it works with Kotlin 1.9.0, compose 1.5.0-beta01 and Intellij 2023.2 |
I am very glad to hear this! @AlexeyTsvetkov I think this issue is resolved; |
@Walingar Can you please check on your side and close this issue? |
One small thing to note, the old broken run configuration still persists(it has Kotlin icon), the new run config has Gradle icon and works. I was manually selecting it and was like not again... |
I updated intellij and used Kotlin 1.9.0, compose 1.5.0-beta01 and Intellij 2023.2 on a desktop only compose project and I am still getting the missing skiko error. I fixed it using the manual import as described in the above comment So for me this is still an issue when I try to run from the gutter. |
@AlexeyTsvetkov just ran into the same issue, can we reopen the ticket?
|
@DarkAtra I'm not sure it is actually the same issue. Could you please provide some additional information?
|
@AlexeyTsvetkov the exception reads:
I tried on both Versions: https://github.com/DarkAtra/bfme2-patcher/blob/compose-issue/gradle.properties#L2-L3 |
Cradle sync firstly, then click the gutter in left of your app main function |
@wwalkingg while that works, it does not allow setting a working directory via the run configuration anymore (this is a blocker for me). What is the reason for switching to gradle jvmRun instead of whatever compose was used in previous versions? |
@DarkAtra we (Compose Multiplatform team) did not change anything in regards to this issue. Some time ago, the Kotlin Multiplatform team had implemented a new, better, faster import. The new import did not consider that IntelliJ was bypassing Gradle when running applications, even if build/test actions are delegated to Gradle. When a user clicked the "run" icon in the gutter, IntelliJ would delegate the build itself, but then ran the application directly using run configuration settings and dependencies it resolved during the last import. IntelliJ's default run mechanism is not very intuitive to both end users and Kotlin project developers. For example, even with the old KMP import, IntelliJ could discover a new runtime dependency only during re-import. However, the new KMP import completely ignored
When the original issue with run from the gutter was uncovered, the new import was already enabled by default. To fix the issue, the Kotlin Multiplatform team has swiftly implemented a new run mechanism, which uses Gradle for both building and running code. As a workaround, you can try to set the working directory in the build script:
The old running mechanism still works for non-multiplatform modules. As long as your project does not target Android/iOS/WASM, you can try to use Also, feel free to send feedback to the Kotlin Multiplatform team directly by creating an issue at https://youtrack.jetbrains.com/issues/KTIJ |
@AlexeyTsvetkov ty for the detailed explanation! i'll try using jvm as i primarily target windows. |
I'm hitting this in multiplatform 1.9.0. I am doing multiplatform for both jvm and android (and other targets), so I had to roll my own jvm app jar because mp doesn't support jvm and android at the same time. The workaround suggested here: #3123 (comment) (import a platform specific jar into the jvm project) works for me. But obviously its counter to the entire point of a JVM project which is to run on many platforms. Any ideas about how/whether putting all the platform-specific jars into my app "fat" jar would work? This is my jvm "fat jar creator" code: /* Put all the dependent files into a single big jar */
tasks.register<Jar>("appJar") {
archiveClassifier.set("app")
manifest {
attributes["Main-Class"] = "my.class.path"
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
for (c in kotlin.targets.named("jvm").get().compilations)
{
val tmp = c.runtimeDependencyFiles
if (tmp != null)
{
// If its a jar blow the jar up and add the class files in that jar
from(tmp.filter { it.name.endsWith("jar") }.map { zipTree(it)})
}
from(c.output)
}
} |
@gandrewstone I don't understand, what |
still happens on Mac M1 if downgrade Kotlin version to 1.8.10 |
Try after gradle sync completely ? |
yep, after a lot ones |
@luangs7 try uninstalling the compose multiplatform plugin in AS/IJ and install it again. |
This issue appears after I upgrading my IDE from version 2022 to 2023, compose multiplatform from 1.3.0 to 1.5.2 and kotlin from 1.8.0 to 1.8.22. It disappears if I downgrade only kotlin back to 1.8.0.
I am using the Compose Multiplatform template generated by InteiiJ IDEA, and then manually updated the versions. The content of gradle.properties is as follow:
|
I also had the same issue but updating the versions like below and run command(./gradlew run) in the terminal fixed the issue. kotlin.version=1.9.0
|
ah no running |
The issue with the non-working green play button just appeared in my current Jetpack Compose Multiplatform project. It happened after I upgraded to the latest Kotlin plugin but as I import the compose libraries without version version numbers it could be as well that it was just something else that updated silently. I use currently
After trying everything that I read here and in other sources about the problem I came up with the following solution:
That way I got at least a working green play button and can wait until some upgrades solve the problem. |
@nantoka69 What Operatin system do you have? |
Windows 10 Pro |
@nantoka69 Can you please provide a minimal reproducible sample? |
There is still an issue on Android Studio; Root cause is that AS does not import Gradle task data and the execution relies on this data being present. The Kotlin Build Tools team is aware of this, right now. |
I had the same problem on Mac. I used the latest IDEA and a project downloaded from the Wizard. STEPS
EXPECTED ACTUAL I tried going into Settings>>Build>>Compiler and change Kotlin compiler to 1.8.22. I then went back to the Wizard and remove Android as a target and repeated the previous steps. So I chnged the name to TestMultiPlatform in the Wizard.
I started over and created a Fresh project called KotlinProject. If I type: ./gradlew run |
I tried the suggestion from nantoka69 above but it did not work using "desktop:run" on MacBook.
|
Describe the bug
When I have a multiplatform Compose project with desktop target, I try to run app with IDEA gutter icon and it fails in runtime with exceptions like:
When use Gradle
:run
everything works fine but really slow, comparing with IDEA start.If I use only jvm target, not multiplatform, starting from gutter works fine as well.
Affected platforms
Select one of the platforms below:
Versions
To Reproduce
Result: it runs, but fails with exceptions like:
Expected behavior
Should work fine.
The text was updated successfully, but these errors were encountered: