Hello everyone. I am getting a lot of errors in gr...
# gradle
f
Hello everyone. I am getting a lot of errors in gradle build file after updating to Android Studio Flamingo and using JDK 17. If I back to JDK 11 works fine. Do you have some idea what can be?
k
Do you need 17? I've found that 11 works the best now
v
What does
./gradlew --version
output?
f
What does
./gradlew --version
output?
Welcome to Gradle 8.0! For more details see https://docs.gradle.org/8.0/release-notes.html ------------------------------------------------------------ Gradle 8.0 ------------------------------------------------------------ Build time: 2023-02-13 131521 UTC Revision: 62ab9b7c7f884426cf79fbedcf07658b2dbe9e97 Kotlin: 1.8.10 Groovy: 3.0.13 Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021 JVM: 17.0.6 (JetBrains s.r.o. 17.0.6+0-17.0.6b802.4-9586694) OS: Mac OS X 13.2.1 aarch64
Why kotlin version is 1.8.10???
one question: The gradle version used when I execute
./gradlew --version
is the version typed in
gradle-wrapper.properties
????
v
The Kotlin version mentioned there is the Kotlin version that is embedded to Gradle, that is used to compile and run Kotlin DSL build scripts or if you use the embedded Kotlin version for example for convention plugins and so on. And yes, the Gradle wrapper uses the Gradle version configured in the wrapper properties file. This way the build is always run with the right Gradle version the build is designed for and knowing to work with.
Gradle 8.0 is compatible with Java 17, so it should work. Maybe you hit some IntelliJ / Android Studio bug. Try "Invalidate caches and restart" option, that often fixes strange IDE behavior.
f
I already tried "Invalidate caches and restart". For now I will keep JDK 11.
another question: What is the purpose of
sourceCompatibility
,
targetCompatibility
and
jvmTarget
??? android { compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 } kotlinOptions { jvmTarget = "1.8" } }
v
I'm not an android developer, so no idea whether there is something Android specific. But generally and Kotlin-specificially, you should usually not set any of them, but use the JVM toolchains configuration imho. :-)