Closed ggoraa closed 3 years ago
We had similar problem earlier: https://github.com/JetBrains/compose-jb/issues/21
And fixed it with https://github.com/JetBrains/compose-jb/pull/30
(we moved buildscript from settings.gradle.kts to the root build.gradle.kts and the problem was gone)
Do you have buildscript in settings.gradle.kts?
I'm facing the same issue as @GGorAA, and my settings.gradle.kts
is identical to that found in the Getting Started guide:
pluginManagement {
repositories {
gradlePluginPortal()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
}
}
Same issue :(
Can you tell which versions of IDEA and Kotlin IDEA plugin do you use?
If it is possible it would be very helpful if you attach project archive here.
Intellij IDEA: 2020.2 Kotlin (plugin): 1.4.10 JB Compose: 0.1.0-m1-build62 JDK Version: 11.0.8 JVM Target: 1.8
Same issue. It happens after creating multiplatform projects from intellij. Intellij IDEA: 2020.3 EAP Runtime version: 11.0.8 VM: Open JDK [64bit]
Repro: https://gofile.io/d/WpJQbh
Intellij IDEA: 2020.2 Kotlin (plugin): 1.4.10 JB Compose: 0.1.0-m1-build62 JDK Version: 11.0.8 JVM Target: 1.8
Unfortunately I can't reproduce the issue on this configuration. I tried to open these templates: https://github.com/JetBrains/compose-jb/tree/master/templates/desktop-template (which is almost the same as described in https://github.com/JetBrains/compose-jb/tree/master/tutorials/Getting_Started) https://github.com/JetBrains/compose-jb/tree/master/templates/multiplatform-template
Can anyone that have this issue attach archive with project?
Also is there "-Xuse-ir" in Project Settings? It should be added automatically after the import of the project. If not - will it be added after Gradle Sync?
Repro: https://gofile.io/d/WpJQbh
Strange enough, The same thing happens with the desktop-template project as well when (importing in Intellij).
I don't have any issue with desktop-template based project. It only happens on MPP template for me.
Repro: https://gofile.io/d/WpJQbh
Multiplatform template from IDEA Wizard currently have this problem (we fixed it in a new version)
Try this: demo.zip
I changed version to "0.1.0-m1-build62" and converted desktop module from kotlin("jvm") to kotlin("multiplatform") (kotlin("jvm") doesn't work well in multiplatform project)
Got new error after tyring to run desktop app,
Repro: https://gofile.io/d/WpJQbh
Multiplatform template from IDEA Wizard currently have this problem (we fixed it in a new version)
Try this: demo.zip
I changed version to "0.1.0-m1-build62" and converted desktop module from kotlin("jvm") to kotlin("multiplatform") (kotlin("jvm") doesn't work well in multiplatform project)
Got new error after trying to run desktop app: Gradle > desktop > Tasks > application > run https://pastebin.com/0MWuepJe
But it works fine if I replace
import me.subash.common.App
import androidx.compose.desktop.Window
fun main() = Window {
App()
}
with
import androidx.compose.desktop.Window
import androidx.compose.material.Text
fun main() = Window {
Text("Hello")
}
Got new error after tyring to run desktop app,
Repro: https://gofile.io/d/WpJQbh
Multiplatform template from IDEA Wizard currently have this problem (we fixed it in a new version) Try this: demo.zip I changed version to "0.1.0-m1-build62" and converted desktop module from kotlin("jvm") to kotlin("multiplatform") (kotlin("jvm") doesn't work well in multiplatform project)
Got new error after trying to run desktop app: Gradle > desktop > Tasks > application > run https://pastebin.com/0MWuepJe
But it works fine if I replace
import me.subash.common.App import androidx.compose.desktop.Window fun main() = Window { App() }
with
import androidx.compose.desktop.Window import androidx.compose.material.Text fun main() = Window { Text("Hello") }
I forgot to change version in android/build.gradle.kts and common/build.gradle.kts
(you can redownload demo from a comment above, I changed the version)
Do you have buildscript in settings.gradle.kts?
I have just copy pasted all code from your getting started guide, and the IDEA just gone wild with errors.
EDIT: I moved pluginManagement
part to build.gradle.kts
, aaand... Everything just broke. Maybe I misunderstood you :D
Multiplatform template from IDEA Wizard currently have this problem (we fixed it in a new version) Try this: demo.zip
Forgot to say, I have the Kotlin/JVM project, not the MPP one
EDIT: Also forgot to say:
Kotlin plugin: 1.4.10 JVM target: 11 JDK: OpenJDK14 IDEA: Latest stable
If it is possible it would be very helpful if you attach project archive here.
Easily. https://drive.google.com/file/d/1VRKk64t8z7GwYD6H2bp1hoF6z7nzYqFq/view?usp=sharing
What exactly version of IDEA? 2020.2.3?
This is what I did to fix the problem: Went into project structure, I had "Use project settings" ticked so I clicked on "Edit project settings" and changed Target JVM Version to 11, then added -Xuse-ir
to the command line options, after these operations red lines were gone. Screenshot of my project settings:
EDIT: I'm using 0.1.0-build113
btw
What exactly version of IDEA? 2020.2.3?
yes
I upgraded to the latest build of JetBrains Compose plugin, added the command line argument, and it is finally working! No more red lines :D
If it is possible it would be very helpful if you attach project archive here.
Easily. https://drive.google.com/file/d/1VRKk64t8z7GwYD6H2bp1hoF6z7nzYqFq/view?usp=sharing
I changed the Gradle version from 6.3 to 6.5.1 and red underlining is gone. On Gradle 6.7 and Compose 0.1.0-build113 everything is fine too.
I will try this too
I also forgot that my target JVM version was 1.6, after the upgrade to 11 every single error is gone
It seems that everything is ok on the latest Gradle (6.7.1), Compose (0.2.0-build129), Kotlin (1.4.20) and Idea (2020.2.3).
We shouldn't manually add "-Xuse-ir" in project settings. It should be added automatically after Gradle Sync.
So if no one encounters this issue again I think we can close it.
Also if it still an issue, maybe similar changes will help: https://github.com/JetBrains/compose-jb/pull/30/files
My solution:
build.gradle.kts
plugins {
val kotlin = "1.5.0-M1"
kotlin("jvm") version kotlin
}
tasks{
val java: String by project
withType<KotlinCompile> {
kotlinOptions { freeCompilerArgs += listOf("-Xskip-prerelease-check", "-Xjsr305=strict"); jvmTarget = java }; sourceCompatibility = java; targetCompatibility = java
}
}
Hello,
I created the base project using you getting started tutorial. Well, it runs, it works, but IntelliJ IDEA thinks it should not work. It shows me the error that I specified in the issue name. How can I fix this?