skip to Main Content

Some Gradle based error that get triggered while compiling the code.
Tried quite a lot of things but nothing seem to help.

What went wrong:
Execution failed for task ':gradle:compileGroovy'.
> BUG! exception in phase 'semantic analysis' in source unit 'C:srcflutterpackagesflutter_toolsgradlesrcmaingroovyapp_plugin_loader.groovy' Unsupported class file major version 65

The above error seem to contain something that the project doesn’t have. Apologies if the question isn’t understandable. My problem is to make the app run and this error doesn’t let me and tried quite a lot of things and nothing seem to have worked.

2

Answers


  1. Chosen as BEST ANSWER

    Ok so the answer for the above can be worked in the following format.

    Gradle issue fix. The below list is about my project version. Yours may differ from mine.

    Java version 17, flutter 3.24.3 on channel stable, dart 3.5.3, dev tools 2.37.3, build tools 34.0.0, Android SDK 34.0.0

    android/gradle.properties : org.gradle.java.home=C:\Program Files\Java\jdk-17

    help > edit custom VM option : -Djava.home=C:Program FilesJavajdk-17

    android/app/build.gradle :

    android { compileOptions {
            sourceCompatibility = JavaVersion.VERSION_17
            targetCompatibility = JavaVersion.VERSION_17
        }
    
        kotlinOptions {
            jvmTarget = '17'
        } }
    

    gradle-wrapper.properties : distributionUrl=https://services.gradle.org/distributions/gradle-7.5-bin.zip

    pubspec.yaml :

    environment:
      sdk: ^3.5.3
    

    Use the relevant updates as you please. Like the Gradle version and SDK versions should be something that you should have and also keep the values consistent. Something i didn't do which lead to more issues.

    I would recommend you to go one step at a time and see what would help. Most of the time your project will be up and running just by fixing android/gradle.properties

    You're welcome :)


  2. please check Your
    this Issue came because of
    JDK version

    1.Verify Java Version
    2. Downgrade or Upgrade Java
    3. Update Gradle:
    4.heck Groovy Version:

    The issue could also be related to an old version of Groovy that doesn’t support the newer Java version. You can try updating the Groovy version in your project or use an earlier version of Java.
    To check Groovy compatibility, ensure the Groovy version is up-to-date in your Gradle configuration:

    dependencies {
        classpath 'org.codehaus.groovy:groovy-all:3.0.9'
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search