skip to Main Content

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not open cp_settings generic class cache for settings file ‘D:workflutterevent_traceandroidsettings.gradle’ (C:UsersHomePC.gradlecaches8.0scripts8ju52g7d2hqvl85b219kdzjzv).

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

  • Try:

Run with –stacktrace option to get the stack trace.
Run with –info or –debug option to get more log output.
Run with –scan to get full insights.

BUILD FAILED in 1m 47s

┌─ Flutter Fix ───────────────────────────────────────────────────────────────────────────────────┐ │ [!] Your project's Gradle version is incompatible with the Java version that Flutter is using   │ │ for Gradle.                                                                                     │ │                                                                                                 │ │ If you recently upgraded Android Studio, consult the migration guide at                         │ │ https://flutter.dev/to/to/java-gradle-incompatibility.                                          │ │                                                                                                 │ │ Otherwise, to fix this issue, first, check the Java version used by Flutter by running flutter  │ │ doctor --verbose.                                                                               │ │                                                                                                 │ │ Then, update the Gradle version specified in                                                    │ │ D:workflutterevent_traceandroidgradlewrappergradle-wrapper.properties to be compatible   │ │ with that Java version. See the link below for more information on compatible Java/Gradle       │ │ versions:                                                                                       │ │ https://docs.gradle.org/current/userguide/compatibility.html#java                               │ │                                                                                                 │ │

What do I need to put in place? The app is not building at all

2

Answers


  1. If you are using java version lower than 20, you should use gradle version lower than 8.0. according to this

    So you need to decrease your gradle version, to do this, open

    /android/gradle/wrapper/gradle-wrapper.properties

    from your project folder and change distributionUrl to gradle-7.6-bin if you’re using java 19, or gradle-7.3-bin if you’re using java 17:

    distributionBase=GRADLE_USER_HOME
    distributionPath=wrapper/dists
    zipStoreBase=GRADLE_USER_HOME
    zipStorePath=wrapper/dists
    distributionUrl=https://services.gradle.org/distributions/gradle-7.6-bin.zip
    
    Login or Signup to reply.
  2. You need to upgrade gradle version according to Java version compatibility in latest Android Studio.
    Follow this link to update gradle version / migration guide :- https://docs.flutter.dev/release/breaking-changes/android-java-gradle-migration-guide

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