is there a permanent solution for gradle scripts t...
# multiplatform
f
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
Sorry I don’t have a solution for you, but I’m having the exact same problem on a new KMM project
v
Have you tried to use gradle 6? I remember having build issues with gradle 7, currently using 6.9.1
f
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
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
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
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
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