skip to Main Content

When I clone the project from GitHub and execute the program it throws this error

Please help all thanks

enter image description here

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

3

Answers


  1. "Unsupported class file major version 61" indicates java 17, which is used by Gradle.

    https://stackabuse.com/bytes/fix-java-error-unsupported-class-file-major-version-63/

    This indicates major class version and corresponding Java versions.

    https://docs.gradle.org/7.3/release-notes.html

    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).

    Login or Signup to reply.
  2. If you run flutter doctor, you probably will see:

    [!] Android Studio (version 2022.1)
        ✗ Unable to find bundled Java version.
    

    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:

    cd /Applications/AndroidStudio.app/Contents
    ln -s jbr jre
    
    Login or Signup to reply.
  3. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search