The horologist sample app has already switched to ...
# compose-wear
y
The horologist sample app has already switched to compileOptions
JavaVersion.VERSION_11
, I am still using
JavaVersion.VERSION_1_8
for most of my wear os apps. Is there any benefits or concerns i shall consider before switching?
f
It just compile faster you can even switch to java 17 that's fine to use and you get a 10% compile time improvement with 17
y
Will the binary still work on wear os 2?
f
If you have the desujar lib it shouldn't be any problems
y
Thats great, thanks.
The build process is really faster after switching to
JavaVersion.VERSION_11
, I got a warning
Copy code
> Task :wear:kaptGenerateStubsDebugKotlin
'compileDebugJavaWithJavac' task (current target is 11) and 'kaptGenerateStubsDebugKotlin' task (current target is 1.8) jvm target compatibility should be set to the same Java version.
I am not sure where is this
kaptGenerateStubsDebugKotlin
task coming from.
f
You need to set kotlinOptions { jvmTarget = '11' }
y
I did that already.
The reason is that the
kotlinOptions
is deprecated in groovy for gradle 7.5. The new syntax is:
Copy code
kotlin {
    jvmToolchain(11)
}
https://stackoverflow.com/questions/69079963/how-to-set-compilejava-task-11-and-compilekotlin-task-1-8-jvm-target-com/75395975#75395975
f
I am talking about the kotlinOptions in
android {}
y
Sure, but the
android { kotlinOptions { jvmTarget = "11"} }
doesn’t work for me with gradle 7.5 and kotlin 1.8.10 for some reason. I have to use the new syntax
android { kotlin { jvmToolchain(11) } }
. And you are right, the
kaptGenerateStudsDebugKotlin
task warning indicate that the
kotlinOptions
for jvmTarget is not set properly.