Gradle assemble error : java.lang.ClassNotFoundException: org.gradle.internal.jvm.UnsupportedJavaRuntimeException

Hi there,
I am having an issue running my code with Flutter on Android Studio.
It seems to be an issue with Gradle, not sure what is causing it.
I already tried reinstalling Flutter and Android Studio, to no avail. Couldn’t even get a different error ^^’
Already tried a bunch of fixes from other issues too, although those might not have been the same problem as mine.

Steps to Reproduce

… didn’t happen for other people i know who use flutter, might have something to do with a version of some package/software/ ?
Since Gradle and the JDK I’m using are bundled with Android studio, which I reinstalled, I really don’t know what external factor could cause that.

Logs

Logs

Error when running the project :

Running Gradle task 'assembleDebug'...
Exception in thread "main" java.lang.NoClassDefFoundError: org/gradle/internal/jvm/UnsupportedJavaRuntimeException
	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
	at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
	at java.lang.Class.getMethod0(Class.java:3018)
	at java.lang.Class.getMethod(Class.java:1784)
	at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:29)
	at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
	at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Caused by: java.lang.ClassNotFoundException: org.gradle.internal.jvm.UnsupportedJavaRuntimeException
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:419)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
	... 8 more
Exception: Gradle task assembleDebug failed with exit code 1

flutter run –verbose

D:\Logiciels\Flutter\flutter>flutter run --verbose
[ +137 ms] executing: [D:\Logiciels\Flutter\flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%%H
[  +83 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%%H
[        ] 9b2d32b605630f28625709ebd9d78ab3016b2bf6
[   +1 ms] executing: [D:\Logiciels\Flutter\flutter/] git tag --points-at HEAD
[  +65 ms] Exit code 0 from: git tag --points-at HEAD
[        ] 1.22.6
[   +8 ms] executing: [D:\Logiciels\Flutter\flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[  +54 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/stable
[        ] executing: [D:\Logiciels\Flutter\flutter/] git ls-remote --get-url origin
[  +49 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[  +82 ms] executing: [D:\Logiciels\Flutter\flutter/] git rev-parse --abbrev-ref HEAD
[  +50 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] stable
[  +69 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +3 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +18 ms] executing: D:\Logiciels\Android\SDK\platform-tools\adb.exe devices -l
[  +48 ms] List of devices attached
           52004b0b5f8a95dd       device product:jackpotltexx model:SM_A530F device:jackpotlte transport_id:2
[   +7 ms] D:\Logiciels\Android\SDK\platform-tools\adb.exe -s 52004b0b5f8a95dd shell getprop
[ +114 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[   +6 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +3 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +24 ms] "flutter run" took 265ms.
[  +19 ms] Error: No pubspec.yaml file found.
           This command should be run from the root of your Flutter project.
           Do not run this command from the root of your git clone of Flutter.
[   +3 ms] 
           #0      FlutterCommand.validateCommand (package:flutter_tools/src/runner/flutter_command.dart:1074:11)
           #1      RunCommand.validateCommand (package:flutter_tools/src/commands/run.dart:348:19)
           #2      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:933:11)
           <asynchronous suspension>
           #3      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:836:33)
           <asynchronous suspension>
           #4      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart)
           #5      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:29)
           #6      _rootRun (dart:async/zone.dart:1190:13)
           #7      _CustomZone.run (dart:async/zone.dart:1093:19)
           #8      _runZoned (dart:async/zone.dart:1630:10)
           #9      runZoned (dart:async/zone.dart:1550:10)
           #10     AppContext.run (package:flutter_tools/src/base/context.dart:149:18)
           #11     FlutterCommand.run (package:flutter_tools/src/runner/flutter_command.dart:825:20)
           #12     CommandRunner.runCommand (package:args/command_runner.dart:197:27)
           #13     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:335:21)
           #14     _rootRunUnary (dart:async/zone.dart:1198:47)
           #15     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
           #16     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
           #17     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
           #18     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
           #19     Future._completeWithValue (dart:async/future_impl.dart:529:5)
           #20     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:40:15)
           #21     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:311:13)
           #22     FlutterVersion.checkFlutterVersionFreshness (package:flutter_tools/src/version.dart)
           #23     _rootRunUnary (dart:async/zone.dart:1198:47)
           #24     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
           #25     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
           #26     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
           #27     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
           #28     Future._completeWithValue (dart:async/future_impl.dart:529:5)
           #29     Future._asyncCompleteWithValue.<anonymous closure> (dart:async/future_impl.dart:567:7)
           #30     _rootRun (dart:async/zone.dart:1190:13)
           #31     _CustomZone.run (dart:async/zone.dart:1093:19)
           #32     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
           #33     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
           #34     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
           #35     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
           #36     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
           #37     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5)
           
           
[ +188 ms] ensureAnalyticsSent: 184ms
[   +2 ms] Running shutdown hooks
[        ] Shutdown hooks complete
[   +1 ms] exiting with code 1

flutter doctor -v

[√] Flutter (Channel stable, 1.22.6, on Microsoft Windows [version 10.0.18363.1316], locale fr-FR)
    • Flutter version 1.22.6 at D:\Logiciels\Flutter\flutter
    • Framework revision 9b2d32b605 (6 weeks ago), 2021-01-22 14:36:39 -0800
    • Engine revision 2f0af37152
    • Dart version 2.10.5

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at D:\Logiciels\Android\SDK
    • Platform android-30, build-tools 30.0.3
    • ANDROID_SDK_ROOT = D:\Logiciels\Android\SDK
    • Java binary at: D:\Logiciels\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[!] Android Studio (version 4.1.0)
    • Android Studio at D:\Logiciels\Android\Android Studio
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] Connected device (1 available)
    • SM A530F (mobile) • 52004b0b5f8a95dd • android-arm64 • Android 9 (API 28)

! Doctor found issues in 1 category.

Idk why it says the Flutter and Dart plugins are not installed, it does the same for other people I know.

pubspec.yaml

name: flutter_login_v2
description: A new Flutter application.
publish_to: 'none'
version: 1.0.0+1

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  url_launcher: ^5.4.0
  keyboard_visibility: ^0.5.6
  introduction_screen: ^1.0.9
  flutter_staggered_grid_view: ^0.3.4
  carousel_slider: ^3.0.0
  flutter:
    sdk: flutter

  cupertino_icons: ^1.0.0

dev_dependencies:
  flutter_test:
    sdk: flutter

  flutter_launcher_icons: "^0.8.1"

flutter_icons:
  image_path: "assets/images/icon.png"
  android: true
  ios: true

flutter:

  uses-material-design: true

  assets:
    - assets/images/
    - assets/GenreIcons/
  fonts:
   - family: Caslon
     fonts:
     - asset: assets/fonts/Caslon-Regular.otf
     - asset: assets/fonts/Caslon-Bold.otf
       weight: 700
   - family: SFCompact
     fonts:
     - asset: assets/fonts/SFCompact-Regular.otf
     - asset: assets/fonts/SFCompact-Bold.otf
       weight: 700
   - family: SFPro
     fonts:
     - asset: assets/fonts/SFPro-Regular.ttf

If anyone has an idea, it would be greatly appreciated.

1 possible answer(s) on “Gradle assemble error : java.lang.ClassNotFoundException: org.gradle.internal.jvm.UnsupportedJavaRuntimeException