<https://kotlinlang.org/api/core/kotlin-stdlib/kot...
# getting-started
u
https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.uuid/-uuid/ The new
Uuid
, I see its in the
stdlib
.. do I explicitly need to include the gradle artifact? Isn't applying
kotlin jvm
plugin enough? I though that one includes the standard library (I'm seeing the newish
Base64
just fine)
h
It’s part of the stdlib since 2.0.20
u
Yes I just moved to 2.1 from 1.9 and wanted to use it but import doesnt show up
h
Did you (accidentally) set the api version to 1.9? When creating a Gradle plugin, Gradle 8 sets it to 1.8 for example.
u
Hmm, I'm trying it in a different project (spring boot with kotlin) and there it does show up. (i.e. just kotlin jvm plugin applied, same as the other project) Is it possible some library is doing the downgrading? I'm not overriding kotlin version explicitly anywhere Although in the project with issues I do include Compose version which needs kotlin 2.0+ and it works just fine Do you have a pointer what should I look for?
d
Can you share your build gradle? We might be able to help identify the issue.
u
the feature module is just plain kotlin.jvm plugin, and then in the root one I won't be able to paste the full one, but only thing that sets some versions is this
Copy code
plugins.withType(com.android.build.gradle.BasePlugin).configureEach { plugin ->
        project.extensions.getByName("android").compileOptions {
            sourceCompatibility = JavaVersion.VERSION_17
            targetCompatibility = JavaVersion.VERSION_17
        }
    }

    tasks.withType(JavaCompile).configureEach { task ->
        task.sourceCompatibility = JavaVersion.VERSION_17
        task.targetCompatibility = JavaVersion.VERSION_17
    }

    tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { task ->
        task.kotlinOptions {
            jvmTarget = "17"
            freeCompilerArgs += [
                    "-opt-in=kotlin.ExperimentalStdlibApi",
                    "-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi"
            ]
        }
    }
d
Hmm, have you tried looking at the classpath? IntelliJ has a nice "analyze dependencies" feature that can help figure out what's going on.
u
https://github.com/square/anvil/releases/tag/v2.5.1 could maybe this be the culprit? they mention they finally support kotlin 2.0+ but "still not K2", which kinda sounds like what you mean?
Okay it is anvil. I added anvil to the project where I had
Uuid
available and it stopped working. Thanks for the hints!
👍 1