Vladislav Ermolin
04/26/2024, 3:24 PMkotlin-stdlib
automatically. However, for some reason, I can’t access StringBuilder
in my commonsMain
source set. At the same time I’ve added a couple of KMP libraries as dependencies to the commonsMain
set explicitly and all entities from them are accessible.
I feel like I’m making some stupid mistake. But I can’t find which one. Any idea what might’ve gone wrong?Michael Krussel
04/26/2024, 3:34 PMVladislav Ermolin
04/26/2024, 3:38 PMVladislav Ermolin
04/26/2024, 3:59 PMlinux64
target. But I only need JVM. Besides, the other libraries, which I use as a reference, do not have such problem.Michael Krussel
04/26/2024, 4:59 PMKuba Petržílka
04/26/2024, 5:29 PMJsExport
neither StringBuilder
in commonMain
sources while it works in the jsMain and jvmMain sourcesKuba Petržílka
04/26/2024, 6:00 PMe: file:///home/kubapet/Projects/dossier-profile-gradle/dossierprofile-publicapi-restapi/src/commonMain/kotlin/AwesomeClass.kt:1:2 Unresolved reference: JsExport
and as Vladislav says the other ilbraries added as commonMain dependencies are accessible from there it is only related to the stdlibKuba Petržílka
04/26/2024, 6:13 PMcommonMain.dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-common:1.9.10") {
version {
strictly("1.9.10")
}
}
but
commonMain.dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-common:1.9.20") {
version {
strictly("1.9.20")
}
}
does not...
maybe related to the migration of kotlin-stdlib-common
to just kotlin-stdlib
?
@Vladislav Ermolin can you verify that it is the case even on your end?Vladislav Ermolin
04/27/2024, 5:26 PMlinux64
target in addition to jvm
solves the issue.Vladislav Ermolin
04/27/2024, 5:28 PM./gradlew build
manages to compile the code, while IDE shows Unresolved reference
.Kuba Petržílka
04/27/2024, 7:21 PMVladislav Ermolin
04/28/2024, 5:57 PMVladislav Ermolin
04/28/2024, 5:57 PMjvm
target code and found out that any attempt to access java
package inside of the jvmMain
also gives unresolved reference.
> Unresolved reference: java
However, in this case project does not compile as well.Vladislav Ermolin
04/28/2024, 7:05 PM<http://java.net|java.net>
classes accessible also in commonMain
target.Kuba Petržílka
04/29/2024, 7:19 AMVladislav Ermolin
04/29/2024, 8:15 AMStringBuilder
available in commonMain
https://kotlinlang.slack.com/archives/C3PQML5NU/p1714238818888659?thread_ts=1714145071.665529&cid=C3PQML5NUVladislav Ermolin
04/29/2024, 8:15 AMjava
classes in commonMain
, which I guess must not be allowed.Kuba Petržílka
04/29/2024, 8:17 AMVladislav Ermolin
04/29/2024, 8:36 AMMichael Krussel
04/29/2024, 1:16 PMjvm
then you can access Java classes from commonMain
. You can access anything that is in all the targets you are targetting.
I don't know why the IDE is showing you an error when it actually compiles. I've encountered a lot of different IDE bugs with KMP over the years. Sometimes doing the invalidate cache stuff and restarting Intellij helps sometimes it doesn't. Best solution is normally to try and find a work around like changing the Java SDK version and filing a bug with JetBrains.Vladislav Ermolin
04/29/2024, 1:19 PMYou can access anything that is in all the targets you are targetting.Indeed, makes sense.
Vladislav Ermolin
04/29/2024, 1:20 PMVladislav Ermolin
04/29/2024, 1:20 PM