Gradle project with 13 java: Unsupported class file major version 57

Answered

I have gradle project, that works on Java 12. Today I'm trying to update to Java 13. Build from command line gradle build works fine on Java 13. When importing gradle project in IDEA this error occurs: Unsupported class file major version 57.

In Settings->Build, Execution, Deployment->Build Tools->Gradle I switch gradle jvm to Java 13 (for all projects). In Project Structure too, for all projects. So, everywhere seems Java 13 option used, but when updating gradle project Unsupported class file major version 57.

Gradle wrapper use gradle-5.6.2.

I use IDEA 2019.2.3 community edition.

Is there a solution?

1
13 comments

Does https://youtrack.jetbrains.com/issue/IDEA-219433 look like your case? Please share the full error log from the sync console.

0
Avatar
Permanently deleted user

There is no error log or stack trace in Sync tab. Looks like this:

Sorry for bluring, security policy.

May be it is possible to enable more detailed logging somewhere in settings?

Issue https://youtrack.jetbrains.com/issue/IDEA-219433 really very similar to my issue, I think.

So, I need to wait when it be fixed and use Java 12 for now? Or other workaround?

0

Do you also also Gradle Kotlin DSL?

I can reproduce the error only if use old Gradle versions (e.g. 4.X).

>Gradle wrapper use gradle-5.6.2.

What do you have specified in Settings (Preferences on macOS) | Build, Execution, Deployment | Build Tools | Gradle | Use Gradle from?

Is it possible to have a sample project? Thanks.

1
Avatar
Permanently deleted user

Yes, I use kotlin dsl in gradle.

In n Settings (Preferences on macOS) | Build, Execution, Deployment | Build Tools | Gradle | Use Gradle from - gradle-wrapper.properies file.

I use windows 10 OS.

I don't have sample project, but I'm try to create empty project soon.

0
Avatar
Permanently deleted user

I create new project by gradle init - https://github.com/alex-t0/KotlinJava13IDEATestProject. But gradle project loads correctly. I create new build configuration - application, select main class, and get same error in run window:

 

So, same error but in different place. May be fix for it helps in both places.

0

Thank you! Attached to the https://youtrack.jetbrains.com/issue/KT-34134 issue. Please follow it for updates.

0
Avatar
Permanently deleted user

For what its work I'm not using a Kotlin DSL, just plain Gradle Java project, I get the same error with Java 13 with Gradle Wrapper. Not a fix but I switched my JRE to 8 and the problem went away - jumped Java 13 too soon I guess. As with cars - never buy a new 'JDK' 

0

@Charles Agyeman check that you can build the project with this JDK from command line by Gradle. Note that Gradle itself supports JDK 13 only since 6.0RC1 build.

1
Avatar
Permanently deleted user

build.gradle

...
wrapper { gradleVersion = '6.0' }
...
0

@K4dima could you add more details? Can you please provide full error and idea.log after IDE restart and reproducing?

0
Avatar
Permanently deleted user

Andrey Dernov it works.

  1. you need a compatible version of jdk
  2. update build.gradle with version 6
  3. sync Gradle or run wrapper task
  4. update jdk to 13
1

@... Thanks for this. Does intellij officially support gradle 6 now, or will this remain a work around?

0

Gradle 6 is supported in the current version.

0

Please sign in to leave a comment.