Как изменить версию Java для Android Studio?

Я хочу изменить версию Java, используемую Android Studio.

Когда я запускаю свое приложение Flutter, оно не запускается, и вот что я получаю в качестве выходного сообщения.Flutte Fix [!] Your project's Gradle version is incompatible with the Java version that Flutter is using for Gradle.

Это как-то странно, потому что я проверил документацию Gradle, свою версию Gradle.7.5совместим с имеющейся у меня версией Java20.0.0

Но, похоже, моя студия Android(Android Studio Giraffe 2022.3.1 , The latest version as of September 2023)принимает во внимание другую версию Java, которая17.

Вот результат, когда я запускаюjava -version

      Java(TM) SE Runtime Environment (build 20.0.2+9-78)
Java HotSpot(TM) 64-Bit Server VM (build 20.0.2+9-78, mixed mode, sharing)```

And here is the output of `flutter doctor -v`
```[✓] Flutter (Channel stable, 3.13.4, on macOS 12.6.3 21G419 darwin-x64, locale en-CM)
    • Flutter version 3.13.4 on channel stable at /Users/baimamboukar/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 367f9ea16b (7 days ago), 2023-09-12 23:27:53 -0500
    • Engine revision 9064459a8b
    • Dart version 3.1.2
    • DevTools version 2.25.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at /Users/baimamboukar/Library/Android/sdk
    • Platform android-33, build-tools 33.0.1
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[!] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 13C100
    ✗ Flutter requires Xcode 14 or higher.
      Download the latest version or update via the Mac App Store.
    • CocoaPods version 1.11.3

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

[✓] Android Studio (version 2022.3)
    • 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 17.0.6+0-17.0.6b829.9-10027231)

[✓] VS Code (version 1.82.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.72.0

[✓] Connected device (3 available)
    • JKM LX2 (mobile) • 192.168.43.1:5555 • android-arm64  • Android 9 (API 28)
    • macOS (desktop)  • macos             • darwin-x64     • macOS 12.6.3 21G419 darwin-x64
    • Chrome (web)     • chrome            • web-javascript • Google Chrome 116.0.5845.187

[✓] Network resources
    • All expected network resources are available.```

0 ответов

Другие вопросы по тегам