I'm fighting multiplatform+compose red imports. I'...
# multiplatform
j
I'm fighting multiplatform+compose red imports. I've read through the big thread that gets linked here and there from two years ago (https://kotlinlang.slack.com/archives/C3PQML5NU/p1652224566469179) but the conclusion there seems to be: fixed in AGP 7.4, which I'm using. Summary: • shared library for
jvm("desktop")
and
android()
• android & desktop app compile fine in IntelliJ* but imports are red for code in `desktopMain`; imports of the same stuff in
commonMain
works • android & desktop app compile fine in Studio and the imports are working * version 2023.1.3, 2023.1.4 Preview and 2023.2 EAP all show the same behaviour on my two development machines I can't figure out if there's something wrong with my project or if I should file a bug for this. I've done a lot of clear caches, rebuilds and even fresh Studio installs and tried different versions. And what confuses me is that desktop works fine in Android Studio. I'd expect the other way around. Code is available on GitHub in this branch if anyone wants to try it: https://github.com/jacobras/ComposeActionMenu/tree/compose-kmp (open the
Main.kt
file in
desktopMain
). There's also a branch
dev-deps
where I upgraded to Kotlin 1.9.0-RC with Compose 1.5.0-dev1094.
s
Looking into the report now !
I checked out the dev-deps branch. Which source file do I need to open to see the red code?
j
sample-desktop/src/jvmMain/kotlin/example.desktop/Main.kt
s
This is green using eap intellij
Would you mind checking again after syncing. If this is still red, are you open to jump into a google meet call with me and investiate?
j
Absolutely!
I've resynced (and cleared build output, caches et cetera) multiple times. I also did a clean check-out on a different machine that immediately had the same issue, so that's why I'm lost 🙂 I'm running on Windows by the way.
Is that
2023.2 EAP
you're using?
s
IntelliJ IDEA 2023.2 EAP (Ultimate Edition) Build #IU-232.8453.116, built on June 29, 2023 Licensed to IntelliJ IDEA EAP user: Sebastian Sellmair Expiration date: July 29, 2023 Runtime version: 17.0.7+7-b1000.2 aarch64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 13.1 GC: G1 Young Generation, G1 Old Generation Memory: 6264M Cores: 8 Metal Rendering is ON Registry: debugger.new.tool.window.layout=true compiler.process.use.portable.caches=true ide.experimental.ui=true Non-Bundled Plugins: com.vermouthx.xcode-theme (1.6.1) jetbrains.team.auth (232.8453.111) com.jetbrains.idea.safepush (232.8453.111) com.jetbrains.intellij.api.watcher (6.62.0) Kotlin: 232-1.8.21-release-380-IJ8453.116
j
Mine is:
Copy code
IntelliJ IDEA 2023.1.3 (Community Edition)
Build #IC-231.9161.38, built on June 20, 2023
Runtime version: 17.0.7+10-b829.16 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 11.0
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 12
Registry:
    debugger.new.tool.window.layout=true
    ide.experimental.ui=true

Non-Bundled Plugins:
    org.jetbrains.kotlin (231-1.9.0-release-358-IJ8770.65)
    androidx.compose.plugins.idea (231.8109.90)
    org.jetbrains.compose.desktop.ide (1.4.1)

Kotlin: 231-1.9.0-release-358-IJ8770.65
(but as mentioned I also tried it with EAP and Preview)
I'm not sure if I tried the
dev
dependencies with EAP specifically. I'll try that now.
For those reading along: it seems to be an issue in import resolution, specifically on Windows. @Sebastian Sellmair [JB] is going to look into it 🙏
I pushed a fix for this issue. Waiting for QA.
❤️ 1
Fix verified by QA. Proposed the cherry pick into intellij 2023.2 and Kotlin 1.9.20
j
Fantastic! Thanks for the updates so far.
s
We just released a news RC of intellij, it is supposed to include the fix already!
🔥 1
m
It is not only the red imports issue. There is also still this https://youtrack.jetbrains.com/issue/KTIJ-20816/Bogus-error-Cannot-inline-bytecode-built-with-JVM-target-11-into-bytecode-that-is-being-built-with-JVM-target-1.8. and other error message inconsistencies. (Tested with the latest RC) E.g., I often have the case that the top line of the editor still shows some errors in its summary but there are no error indications in the text or even the file tree view. The solution often is to just close and then reopen the file which is not a very good user experience.