Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
yann-dupont opened this issue Mar 3, 2021 · 12 comments
Labels
r: solved Issue is closed as solved

Comments

@yann-dupont
Copy link

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.

@Juliotati

This comment has been minimized.

@yann-dupont

This comment has been minimized.

@Juliotati
Copy link

Oh no nevermind, the log message was minimized, didn't notice.
Try updating your dependencies in android/build.gradle and your grandle version if it's the old version

@darshankawar darshankawar added the in triage Presently being triaged by the triage team label Mar 4, 2021
@darshankawar
Copy link
Member

@yann-dupont
Your verbose log shows below error:

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.

Are you sure you are running flutter run from root of your project ? Do you see the pubpsec.yaml in the root hierarchy ?
If so, can you provide your project level and app level build.gradle files in properly formatted text ?

@darshankawar darshankawar added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Mar 4, 2021
@yann-dupont
Copy link
Author

My bad, I was indeed running flutter run --verbose from the wrong directory, here's the right output :

[ +173 ms] executing: [D:\Logiciels\Flutter\flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[ +106 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[   +1 ms] 9b2d32b605630f28625709ebd9d78ab3016b2bf6
[   +1 ms] executing: [D:\Logiciels\Flutter\flutter/] git tag --points-at HEAD
[ +104 ms] Exit code 0 from: git tag --points-at HEAD
[   +2 ms] 1.22.6
[  +13 ms] executing: [D:\Logiciels\Flutter\flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[  +90 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[   +2 ms] origin/stable
[   +3 ms] executing: [D:\Logiciels\Flutter\flutter/] git ls-remote --get-url origin
[  +75 ms] Exit code 0 from: git ls-remote --get-url origin
[   +2 ms] https://github.com/flutter/flutter.git
[ +106 ms] executing: [D:\Logiciels\Flutter\flutter/] git rev-parse --abbrev-ref HEAD
[  +68 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[   +2 ms] stable
[ +102 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[   +3 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[   +4 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.
[   +6 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[   +3 ms] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[   +2 ms] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[   +2 ms] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +29 ms] executing: D:\Logiciels\Android\SDK\platform-tools\adb.exe devices -l
[  +82 ms] List of devices attached
           52004b0b5f8a95dd       device product:jackpotltexx model:SM_A530F device:jackpotlte transport_id:1
[  +14 ms] D:\Logiciels\Android\SDK\platform-tools\adb.exe -s 52004b0b5f8a95dd shell getprop
[ +160 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[  +16 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[   +3 ms] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[   +2 ms] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +8 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[   +4 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[   +2 ms] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[   +2 ms] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[   +2 ms] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[   +2 ms] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[   +4 ms] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +217 ms] Found plugin keyboard_visibility at
D:\Logiciels\Flutter\flutter\.pub-cache\hosted\pub.dartlang.org\keyboard_visibility-0.5.6\
[  +25 ms] Found plugin url_launcher at
D:\Logiciels\Flutter\flutter\.pub-cache\hosted\pub.dartlang.org\url_launcher-5.7.10\
[   +6 ms] Found plugin url_launcher_linux at
D:\Logiciels\Flutter\flutter\.pub-cache\hosted\pub.dartlang.org\url_launcher_linux-0.0.1+4\
[   +4 ms] Found plugin url_launcher_macos at
D:\Logiciels\Flutter\flutter\.pub-cache\hosted\pub.dartlang.org\url_launcher_macos-0.0.1+9\
[   +8 ms] Found plugin url_launcher_web at
D:\Logiciels\Flutter\flutter\.pub-cache\hosted\pub.dartlang.org\url_launcher_web-0.1.5+3\
[   +5 ms] Found plugin url_launcher_windows at
D:\Logiciels\Flutter\flutter\.pub-cache\hosted\pub.dartlang.org\url_launcher_windows-0.0.1+3\
[ +325 ms] Found plugin keyboard_visibility at
D:\Logiciels\Flutter\flutter\.pub-cache\hosted\pub.dartlang.org\keyboard_visibility-0.5.6\
[  +23 ms] Found plugin url_launcher at
D:\Logiciels\Flutter\flutter\.pub-cache\hosted\pub.dartlang.org\url_launcher-5.7.10\
[   +4 ms] Found plugin url_launcher_linux at
D:\Logiciels\Flutter\flutter\.pub-cache\hosted\pub.dartlang.org\url_launcher_linux-0.0.1+4\
[   +4 ms] Found plugin url_launcher_macos at
D:\Logiciels\Flutter\flutter\.pub-cache\hosted\pub.dartlang.org\url_launcher_macos-0.0.1+9\
[   +5 ms] Found plugin url_launcher_web at
D:\Logiciels\Flutter\flutter\.pub-cache\hosted\pub.dartlang.org\url_launcher_web-0.1.5+3\
[   +3 ms] Found plugin url_launcher_windows at
D:\Logiciels\Flutter\flutter\.pub-cache\hosted\pub.dartlang.org\url_launcher_windows-0.0.1+3\
[  +31 ms] Generating
D:\GitHub\Culturons-Nous\flutter_login_v2\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java
[  +32 ms] ro.hardware = samsungexynos7885
[   +2 ms] ro.build.characteristics = phone
[  +68 ms] Starting incremental build...
[   +6 ms] Initializing file store
[  +22 ms] Skipping target: gen_localizations
[  +10 ms] complete
[  +10 ms] Launching lib\main.dart on SM A530F in debug mode...
[  +12 ms] D:\Logiciels\Flutter\flutter\bin\cache\dart-sdk\bin\dart.exe --disable-dart-dev
D:\Logiciels\Flutter\flutter\bin\cache\artifacts\engine\windows-x64\frontend_server.dart.snapshot --sdk-root
D:\Logiciels\Flutter\flutter\bin\cache\artifacts\engine\common\flutter_patched_sdk/ --incremental --target=flutter
--debugger-module-names --experimental-emit-debug-metadata -Ddart.developer.causal_async_stacks=true --output-dill
C:\Users\Yumahey\AppData\Local\Temp\flutter_tools.ecb96a7b\flutter_tool.bfbeae4a\app.dill --packages .packages
-Ddart.vm.profile=false -Ddart.vm.product=false
--bytecode-options=source-positions,local-var-info,debugger-stops,instance-field-initializers,keep-unreachable-code,avoi
d-closure-call-instructions --enable-asserts --track-widget-creation --filesystem-scheme org-dartlang-root
--initialize-from-dill build\cache.dill.track.dill
[  +31 ms] executing: D:\Logiciels\Android\SDK\platform-tools\adb.exe -s 52004b0b5f8a95dd shell -x logcat -v time -t 1
[ +170 ms] Exit code 0 from: D:\Logiciels\Android\SDK\platform-tools\adb.exe -s 52004b0b5f8a95dd shell -x logcat -v time
-t 1
[   +2 ms] --------- beginning of main
           03-04 09:29:37.915 D/WifiPermissionsUtil( 3537): canAccessScanResults: pkgName = com.sec.android.sdhms, uid =
           1000
[   +3 ms] executing: D:\Logiciels\Android\SDK\platform-tools\adb.exe -s 52004b0b5f8a95dd shell -x logcat -v time -t 1
[ +160 ms] Exit code 0 from: D:\Logiciels\Android\SDK\platform-tools\adb.exe -s 52004b0b5f8a95dd shell -x logcat -v time
-t 1
[   +5 ms] --------- beginning of main
           03-04 09:29:39.773 D/Netd    ( 3216): notify() code: 613, msg: IfaceClass idle 1 4124332445235
[  +53 ms] <- compile package:flutter_login_v2/main.dart
[  +38 ms] executing: D:\Logiciels\Android\SDK\platform-tools\adb.exe version
[ +122 ms] Android Debug Bridge version 1.0.41
                    Version 30.0.5-6877874
                    Installed as D:\Logiciels\Android\SDK\platform-tools\adb.exe
[   +7 ms] executing: D:\Logiciels\Android\SDK\platform-tools\adb.exe start-server
[  +65 ms] Building APK
[  +36 ms] Running Gradle task 'assembleDebug'...
[   +6 ms] gradle.properties already sets 'android.enableR8'
[   +7 ms] Using gradle from D:\GitHub\Culturons-Nous\flutter_login_v2\android\gradlew.bat.
[   +3 ms] D:\GitHub\Culturons-Nous\flutter_login_v2\android\gradlew.bat mode: 33279 rwxrwxrwx.
[  +27 ms] executing: D:\Logiciels\Android\Android Studio\jre\bin\java -version
[ +157 ms] Exit code 0 from: D:\Logiciels\Android\Android Studio\jre\bin\java -version
[   +2 ms] openjdk version "1.8.0_242-release"
           OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
           OpenJDK 64-Bit Server VM (build 25.242-b01, mixed mode)
[   +5 ms] executing: [D:\GitHub\Culturons-Nous\flutter_login_v2\android/]
D:\GitHub\Culturons-Nous\flutter_login_v2\android\gradlew.bat -Pverbose=true -Ptarget-platform=android-arm64
-Ptarget=D:\GitHub\Culturons-Nous\flutter_login_v2\lib\main.dart -Ptrack-widget-creation=true
-Pfilesystem-scheme=org-dartlang-root assembleDebug
[ +387 ms] Exception in thread "main" java.lang.NoClassDefFoundError:
org/gradle/internal/jvm/UnsupportedJavaRuntimeException
[   +6 ms]      at java.lang.Class.getDeclaredMethods0(Native Method)
[   +2 ms]      at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
[   +3 ms]      at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
[   +2 ms]      at java.lang.Class.getMethod0(Class.java:3018)
[   +2 ms]      at java.lang.Class.getMethod(Class.java:1784)
[   +2 ms]      at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:29)
[   +2 ms]      at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
[   +4 ms]      at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
[   +2 ms] Caused by: java.lang.ClassNotFoundException: org.gradle.internal.jvm.UnsupportedJavaRuntimeException
[   +2 ms]      at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
[   +2 ms]      at java.lang.ClassLoader.loadClass(ClassLoader.java:419)
[   +2 ms]      at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
[   +4 ms]      ... 8 more
[  +73 ms] Running Gradle task 'assembleDebug'... (completed in 0,7s)
[+7874 ms] Exception: Gradle task assembleDebug failed with exit code 1
[   +6 ms] "flutter run" took 10 521ms.
[  +12 ms]
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:14:3)
           #1      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:607:7)
           <asynchronous suspension>
           #2      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:977:18)
           #3      _rootRunUnary (dart:async/zone.dart:1198:47)
           #4      _CustomZone.runUnary (dart:async/zone.dart:1100:19)
           #5      _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
           #6      Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
           #7      Future._propagateToListeners (dart:async/future_impl.dart:725:32)
           #8      Future._completeWithValue (dart:async/future_impl.dart:529:5)
           #9      _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:40:15)
           #10     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:311:13)
           #11     RunCommand.usageValues (package:flutter_tools/src/commands/run.dart)
           #12     _rootRunUnary (dart:async/zone.dart:1198:47)
           #13     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
           #14     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
           #15     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
           #16     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
           #17     Future._completeWithValue (dart:async/future_impl.dart:529:5)
           #18     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:40:15)
           #19     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:311:13)
           #20     AndroidDevice.isLocalEmulator (package:flutter_tools/src/android/android_device.dart)
           #21     _rootRunUnary (dart:async/zone.dart:1198:47)
           #22     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
           #23     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
           #24     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
           #25     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
           #26     Future._completeWithValue (dart:async/future_impl.dart:529:5)
           #27     Future._asyncCompleteWithValue.<anonymous closure> (dart:async/future_impl.dart:567:7)
           #28     _rootRun (dart:async/zone.dart:1190:13)
           #29     _CustomZone.run (dart:async/zone.dart:1093:19)
           #30     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
           #31     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
           #32     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
           #33     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
           #34     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
           #35     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5)


[ +105 ms] ensureAnalyticsSent: 92ms
[   +6 ms] Running shutdown hooks
[   +3 ms] Shutdown hook priority 4
[  +13 ms] Shutdown hooks complete
[   +4 ms] exiting with code 1

pubspec.yaml is indeed present, in the root of the project. I put it in the first post.

Here are the build.gradle files :
android/build.gradle

buildscript {
    ext.kotlin_version = '1.3.50'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

android/app/build.gradle

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 29

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.cn.flutter_login_v2"
        minSdkVersion 16
        targetSdkVersion 29
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    buildTypes {
        release {
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

I should mention that the error occurs for every project I try to create, but not when another person runs the exact same project on their computer. That's why I think it's caused by something external to the projects.

@no-response no-response bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Mar 4, 2021
@darshankawar
Copy link
Member

@yann-dupont
What does the gradle-wrapper version show ? (android/gradle/wrapper/gradle-wrapper.properties)

Regarding Idk why it says the Flutter and Dart plugins are not installed, it does the same for other people I know.. this is just a warning and doesn't affect your development. It is already fixed in master branch.

Can you upgrade to latest stable (2.0.0) and try again flutter run to see if you still get same issue or not ?

@darshankawar darshankawar added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Mar 4, 2021
@yann-dupont
Copy link
Author

gradle-wrapper.properties :

#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip

Still throws the same error after upgrading to 2.0.0.

@no-response no-response bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Mar 4, 2021
@Juliotati
Copy link

Try also to update your dependencies.
Latest versions as of now

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

distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip

In android/build.gradle

buildscript {
    ext.kotlin_version = '1.4.31'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

@yann-dupont
Copy link
Author

@Juliotati that actually worked, thank you so much !

@Juliotati
Copy link

Great 🥳 you can close the issue now.
@yann-dupont
@darshankawar

@darshankawar
Copy link
Member

Closing this as resolved based on comments above.

@darshankawar darshankawar added r: solved Issue is closed as solved and removed in triage Presently being triaged by the triage team labels Mar 5, 2021
@github-actions
Copy link

github-actions bot commented Aug 5, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
r: solved Issue is closed as solved
Projects
None yet
Development

No branches or pull requests

3 participants