"General error during conversion: Unsupported class file major version 63"
I’ve tried multiple suggestions on here. None have worked. I think I need more of a step-by-step solution because I’ve tried installing multiple versions of Java (19,16,11), flutter clean
, flutter doctor
is all good, and I’ve installed a newer version of Android Studio (just in case). Here is what I see in VSCode:
2
Answers
I encountered this error while trying to run Flutter integration tests on Firebase Test Lab. I was able to solve this by updating a few things in Android Studio.
Update the Project’s JDK
Open the Android Studio project settings page (File -> Project Settings) and add the newest JDK version.
Update com.android.tools.build:gradle
In android/build.gradle, update the com.android.tools.build:gradle value to the latest version found here.
Update the gradle distributionUrl
In
android/gradle/wrapper/gradle-wrapper.properties
, update the distributionUrl property to use the latest Gradle version.Other Useful Tips
You can type
/usr/libexec/java_home
into the terminal to see which version of Java you have installed.You can find the current value of JAVA_HOME by running
%echo $JAVA_HOME
in your terminal (source).You can update JAVA_HOME by following these steps
The problem is that somehow, either deliberately or inadvertently, you’ve built one or more Java files (or you’re using one or more 3rd party .jars) with Java 19 … but your "build environment" is using an older JRE. Hence the
Unsupported class file
error.I, too, am using VSCode for my Flutter IDE; and I, too have Android Studio in my environment. Unfortunately, there are constantly new releases for Flutter, for VSCode, for the Android SDK, for Android Studio (with its own embedded Java/Kotlin!) and – last, but not least – for Gradle and the A/S Gradle plugin. Any one of them falling out of sync can break your entire development environment 🙁
I just tried to rebuild a project that compiled fine a few months ago… and (as expected) the build failed. None of the source change – but I recently upgraded A/S, and that inadvertently broke the Flutter build 🙁
SUGGESTION:
See if you can identify which Java class or .jar is using Java 19 … and back it down to an older version.
In parallel, upgrade EVERYTHING in your build environment:
flutter upgrade
=> Flutter 3.7.3, Dart 2.19.2VSCode update,
pub upgrade
=> VSCode 1.751, Dart Code 3.58.0A/S upgrade => Electric Eel 2022.1.1 Patch 1, Gradle Plugin 4.2.2
Note: Gradle Plugin 4.2.2 => Gradle version => 6.7.1, Default=Java8, AGP dependency 4.2.2
A/S Electric Eel gives you java 11… in (new!) directory "c:Program FilesAndroidAndroid Studiojbr"