Trying to update to Compose Compiler 1.4.5 and I'm seeing the following error. Anyone else run into ...
m
Trying to update to Compose Compiler 1.4.5 and I'm seeing the following error. Anyone else run into this? I'm using JDK 11.
👀 1
i
that's Java 17
m
That's what I figured. But no where in the release notes am I seeing a mention of this "breaking" change: https://developer.android.com/jetpack/androidx/releases/compose-compiler#version_145_3
k
Are you building from command line or from Studio?
m
Command line.
I guess I'm wondering if potentially making JDK 17 required was intended for Compose Compiler 1.4.5. 🤔
I'm seeing the same issue in CI (GitHub Action) which has always been configured to use Java 11 for our build jobs.
b
The forced upgrade to Java 17 is being rolled back in another release
m
The release notes have also been updated to include this information about the JDK 17 requirement for 1.4.5.
c
there was a force update for compose + jdk?
m
Yes, but next week there will be a 1.4.6 release that reverts back to JDK 11.
f
Do you think 1.4.6 release is available this week or the next??
m
I believe it is supposed to come out this week. But for what it's worth, Android Gradle Plugin 8 also shipped last week and it too requires JDK 17. So if you're interested in updating to Android Gradle Plugin 8, Gradle
8.x
, and Kotlin 1.8.20, you'll have to update to JDK 17 regardless.
From there, Compose Compiler
1.4.5
can be used as is without having to wait for
1.4.6
😄
f
Ok, I want to update a library to kotlin 1.8.20 // compose-multiplatform 1.4.0 // compose-compiler 1.4.5/1.4.6 but I do not want to force the JDK 17
m
If I'm not mistaken, I believe I saw a warning from the Kotlin Multiplatform plugin with Kotlin 1.8.20 that Gradle 7.x is not officially supported. 🤷‍♂️
It's inevitable if you want to keep up with the latest and greatest tooling to ultimately update to JDK 17.
You'd still target Java 11 with JDK 17.
If I'm not mistaken, I believe I saw a warning from the Kotlin Multiplatform plugin with Kotlin 1.8.20 that Gradle 7.x is not officially supported. 🤷‍♂️
I could be wrong though. 🙂
f
You'd still target Java 11 with JDK 17.
Like this???
Copy code
compileOptions {
    sourceCompatibility = JavaVersion.VERSION_11
    targetCompatibility = JavaVersion.VERSION_11
}
m
For Android library modules, yes.
If you have pure JVM modules, you'll need to do
Copy code
tasks.withType<KotlinCompile>().configureEach {
    kotlinOptions {
        jvmTarget = "11"
    }
}

// If you still have code in Java.
// This includes if you use Dagger/Hilt with pure Kotlin since Dagger/Hilt code-gen is in Java.
tasks.withType<JavaCompile>().configureEach {
    sourceCompatibility = "11"
    targetCompatibility = "11"
}
Assuming Kotlin Gradle DSL ☝️
f
So if I publish a library with JDK 17, a consumer can build it with JDK 11 ???
m
I believe as long as the source and target compatibility are properly configured to 11, yes. Does your library have a sample app that you can test this with?
j
Compose Compiler 1.4.6 with support for Java11 toolchain is released: https://developer.android.com/jetpack/androidx/releases/compose-compiler#1.4.6