https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
f

fvink

11/11/2021, 4:41 PM
is there a permanent solution for gradle scripts throwing errors after making changes to build.gradle files? deleting .gradle and .idea folders fixes the issue but it keeps happening. not sure if this a KMM issue, but I’ve only seen this in a KMM project. i use gradle 7.2 this seems to be happening when Gradle JDK is set to 11. Changing it to 1.8 fixes the issue but then compiling throws an error
Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
😅
e

Ernestas

11/11/2021, 6:01 PM
Sorry I don’t have a solution for you, but I’m having the exact same problem on a new KMM project
v

Vadim

11/11/2021, 6:21 PM
Have you tried to use gradle 6? I remember having build issues with gradle 7, currently using 6.9.1
f

fvink

11/11/2021, 6:33 PM
Not yet, changing the gradle version also means changing a bunch of other things
I guess one of the solutions is to write the gradle scripts in groovy instead. seems to work better than kotlin in my case
m

mkrussel

11/11/2021, 8:32 PM
Gradle 7 requires Java 11 JVM to run regardless of Groovy or Kotlin. You can still target 1.8, but you need to build with at least JDK 11.
f

fvink

11/11/2021, 9:17 PM
Maybe i misunderstood your point, but setting the Gradle JDK in AS preferences to JDK 11 breaks the build.gradle.kts script (the screenshot i posted) @mkrussel
m

mkrussel

11/11/2021, 10:08 PM
I've never seen that error, but from my understanding the gradle won't run at all with JDK 8, so I don't think downgraded removed the problem, but more likely hide it.
f

fvink

11/12/2021, 9:15 AM
That is possible.
Seems I’ve resolved the issue. I downloaded and selected Amazon Corretto JDK 16 as gradle jdk. No errors popping up and the build works fine. cc @Ernestas
👍 2
11 Views