项目运行报错,疑似java版本和gradle版本不匹配
1665169869 opened this issue · 0 comments
1665169869 commented
Launching lib/main.dart on sdk gphone64 x86 64 in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
* What went wrong:
Could not open cp_settings generic class cache for settings file '/home/cw1665169869/code/Themby/android/settings.gradle' (/home/cw1665169869/.gradle/caches/7.6.4/scripts/1m62oyhiqbfu2oqua2b3j2iyq).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 67
* 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 2s
┌─ 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 │
│ /home/cw1665169869/code/Themby/android/gradle/wrapper/gradle-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 │
│ │
│ │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
Error: Gradle task assembleDebug failed with exit code 1
flutter doctor:
❯ flutter doctor -v
[✓] Flutter (Channel stable, 3.24.4, on Deepin 23 6.6.47-amd64-desktop-hwe, locale zh_CN.UTF-8)
• Flutter version 3.24.4 on channel stable at
/home/cw1665169869/development/flutter_linux_3.24.4-stable/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 603104015d (5 周前), 2024-10-24 08:01:25 -0700
• Engine revision db49896cf2
• Dart version 3.5.4
• DevTools version 2.37.3
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /home/cw1665169869/Android/Sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: /opt/apps/android-studio-2024.2.1.11-linux/android-studio/jbr/bin/java
• Java version OpenJDK Runtime Environment (build 21.0.3+-12282718-b509.11)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at google-chrome
[✗] Linux toolchain - develop for Linux desktop
✗ clang++ is required for Linux development.
It is likely available from your distribution (e.g.: apt install clang), or can be downloaded from
https://releases.llvm.org/
✗ CMake is required for Linux development.
It is likely available from your distribution (e.g.: apt install cmake), or can be downloaded from
https://cmake.org/download/
✗ ninja is required for Linux development.
It is likely available from your distribution (e.g.: apt install ninja-build), or can be downloaded from
https://github.com/ninja-build/ninja/releases
• pkg-config version 1.8.1
✗ GTK 3.0 development libraries are required for Linux development.
They are likely available from your distribution (e.g.: apt install libgtk-3-dev)
[✓] Android Studio (version 2024.2)
• Android Studio at /opt/apps/android-studio-2024.2.1.11-linux/android-studio
• Flutter plugin version 82.1.3
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 21.0.3+-12282718-b509.11)
[✓] Connected device (3 available)
• sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 15 (API 35) (emulator)
• Linux (desktop) • linux • linux-x64 • Deepin 23 6.6.47-amd64-desktop-hwe
• Chrome (web) • chrome • web-javascript • Google Chrome 130.0.6723.116
[✓] Network resources
• All expected network resources are available.
! Doctor found issues in 1 category.