skip to Main Content

Kotlin is now version 1.9

When I created a new project in Android Studio (Giraffe), it was still targeting Kotlin 1.8.

I change the build.gradle below to 1.9

    kotlinOptions {
        jvmTarget = "1.9"
    }

But it error out stating Unknown Kotlin JVM target: 1.9

I check https://blog.jetbrains.com/kotlin/2023/07/kotlin-1-9-0-released/, and it mentions

For Android Studio Giraffe (223) and Hedgehog (231), the Kotlin 1.9.0
plugin will be included in upcoming Android Studios updates.

How would I know if I got the plugin already? How to install it if I don’t have the plugin yet?

3

Answers


  1. Chosen as BEST ANSWER

    Looks like I can set it in the project's build.gradle.kts, i.e. setting it to 1.9.10

    plugins {
        id("com.android.application") version "8.1.0" apply false
        id("org.jetbrains.kotlin.android") version "1.9.10" apply false
    }
    

  2. In Android Studio:

    Settings -> Languages & Frameworks -> Kotlin

    And you can check your Kotlin version from there.

    EDIT:
    (See this also)

    Login or Signup to reply.
  3. I think the problem comes from the typo in a documentation somewhere.
    Like here:
    enter image description here

    Just use jvmTarget = "19" instead. As the documentation says this option meaning is "Target version of the generated JVM bytecode". So "1.9" is impossible as Java 1.9 doesn’t exist.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search