macosflutterandroid-studio

BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 61 on Apple Arm


I have installed Android Studio Canary 2020.3.1.22 and trying to run Flutter project on Apple Silicon(ARM) Mac. Unfortunately, it is giving me this error when I try to run default flutter counter app.

Here is the error I am getting:

Could not open settings generic class cache for settings file '/Users/khamidjonkhamidov/StudioProjects/dummy/android/settings.gradle' (/Users/khamidjonkhamidov/.gradle/caches/6.7/scripts/f0emg6u6oecmxqzgk5g9nn4ui).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 61

Gradle version: 6.7 but I tried 7+ JDK version 17

I would really appreciate your help)


Solution

  • According to the official grade docs: Java 17 and later versions are not yet supported.

    You can check compatibility here.

    So I have installed Java11 from Azul.

    p.s. don't forget to change jdk version in Android studio which is available only on the Android project, to open it

    File-> open -> select the android folder inside your flutter project -> open in a new window

    Then you can change jdk version Preferences -> Build -> Build Tools -> Gradle -> Gradle JDK