Per this link, Java 17 support was added circa Gradle 7.3, so either upgrade to a more recent version of Gradle, or change your settings to use an earlier version of Java (such as JAVA_HOME if using the CLI).
right click and click show package contents
Create a new folder called jre
copy the contents of the jbr folder and paste them into jre folder
reload your terminal and type flutter doctor
For Windows:
C:Program FilesAndroidAndroid Studio
then copy the content of jbr and paste the content into jre folder
run doctor again and problem solved
3
Answers
"Unsupported class file major version 61" indicates java 17, which is used by Gradle.
This indicates major class version and corresponding Java versions.
Per this link, Java 17 support was added circa Gradle 7.3, so either upgrade to a more recent version of Gradle, or change your settings to use an earlier version of Java (such as
JAVA_HOME
if using the CLI).If you run
flutter doctor
, you probably will see:https://github.com/flutter/flutter/issues/118502 seems to be the latest issue in which this crops up. https://github.com/flutter/flutter/issues/106674 notes they reverted a buggy change, but it hasn’t hit stable yet, so you’ll have to symlink the bundled JRE folder as a workaround til the next AS update.
e.g. for mac, you can use:
For Mac:
Go to finder and find Android studio:
right click and click show package contents
Create a new folder called jre
copy the contents of the jbr folder and paste them into jre folder
reload your terminal and type flutter doctor
For Windows:
C:Program FilesAndroidAndroid Studio
then copy the content of jbr and paste the content into jre folder
run doctor again and problem solved