'FAILURE: Build failed with an exception Flutter project

Facing this issue while running on android
FAILURE: Build failed with an exception.

* What went wrong:
Could not open settings generic class cache for settings file '/Volumes/Macintosh Data/flutter_app/android/settings.gradle' (/Users/myimac/.gradle/caches/6.7/scripts/f0emg6u6oecmxqzgk5g9nn4ui).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 61

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

* Get more help at https://help.gradle.org

BUILD FAILED in 4s
Exception: Gradle task assembleDebug failed with exit code 1
My environment
[✓] Flutter (Channel stable, 2.10.3, on Mac OS X 10.15.7 19H1715 darwin-x64,
    locale en-US)
    • Flutter version 2.10.3 at /Users/myimac/Developer/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 7e9793dee1 (4 days ago), 2022-03-02 11:23:12 -0600
    • Engine revision bd539267b4
    • Dart version 2.16.1
    • DevTools version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version
    32.1.0-rc1)
    • Android SDK at /Users/myimac/Library/Android/sdk
    • Platform android-32, build-tools 32.1.0-rc1
    • Java binary at:
      /Library/Java/JavaVirtualMachines/jdk1.8.0_321.jdk/Contents/Home/bin/java
    • Java version Java(TM) SE Runtime Environment (build 1.8.0_321-b07)
    • All Android licenses accepted.

[!] Xcode - develop for iOS and macOS (Xcode 12.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    ! Flutter recommends a minimum Xcode version of 13.
      Download the latest version or update via the Mac App Store.
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)

[✓] Connected device (3 available)
    • sdk gphone x86 64 (mobile) • emulator-5554 • android-x64    • Android 11
      (API 30) (emulator)
    • macOS (desktop)            • macos         • darwin-x64     • Mac OS X
      10.15.7 19H1715 darwin-x64
    • Chrome (web)               • chrome        • web-javascript • Google
      Chrome 99.0.4844.51

[✓] HTTP Host Availability
    • All required HTTP hosts are available


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source