BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 61 in intellija idea

4.7k Views Asked by At

BUG! exception in phase 'semantic analysis' in source unit 'BuildScript' Unsupported class file major version 61

enter image description here

1

There are 1 best solutions below

3
Joffrey On

I got this yesterday too. Check the version of Gradle you are using vs the version of the JDK.

Since you're not using the Gradle wrapper, maybe for you it's just a matter of upgrading Gradle and/or the JDK.

I was using the Gradle wrapper so it's a bit different, but essentially the problem was that I updated my wrapper properties to Gradle 7.3.3, but the currently downloaded gradle was still the old one (too old) which was not compatible with my JDK 17.

For some reason, I needed to configure Gradle in IDEA to use the properties file instead of the wrapper task for it to work:

gradle settings menu dropdown

gradle settings wrapper properties