Gradle 版本与 Java 版本不兼容 ||颤动 ||异常“语义分析”源单元“_BuildScript_”不支持的类版本 65

问题描述 投票:0回答:1

更新后出现此错误。就像我使用的 android studio 是最新的java JDK id 17,然后我在 11 中更改它,但仍然无法正确的 Gradle 版本。

请提出像正确的 Gradle 版本这样的想法,我必须在我的项目中使用它。

FAILURE: Build failed with an exception.

* What went wrong:
Could not open settings generic class cache for settings file 'D:\Flutter\suprbFluter\saveCode\fluter\android\settings.gradle' (C:\Users\sonal\.gradle\caches\8.1.1\scripts\ernrjmhpn64ovli3a1sz8s5gv).
> 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.

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

BUILD FAILED in 32s

┌─ 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:\Flutter\suprbFluter\saveCode\fluter\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

enter image description here

enter image description here

dart android-studio gradle build.gradle version
1个回答
0
投票

过去两三天我也遇到了这个问题,但我找到了解决方案。问题是您下载的是最新版本的Android Studio,该版本不兼容。您需要下载旧版本的 Android Studio。

© www.soinside.com 2019 - 2024. All rights reserved.