Skip to content

Different java versions used in 'compileDebugJavaWithJavac' and 'compileDebugKotlin' #59

@SlothSpunky77

Description

@SlothSpunky77

Build is successful but running fails. On running on an android phone, this is the error:

'compileDebugJavaWithJavac' task (current target is 1.8) and 'compileDebugKotlin' task (current target is 17) jvm target compatibility should be set to the same Java version.
  Consider using JVM toolchain: https://kotl.in/gradle/jvm/toolchain

I've already included the JVM toolchain by adding the following in my android/app/build.gradle.kts:

{
    ...
    kotlin {
        jvmToolchain(17)
    }
    ...
}

I am using gradle version 8.13 and AGP version 8.9.1, running on android 35. Android studio ships the latest kotlin version with it by default.
What could be the issue and how can I resolve it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions