With the help of @Robert answer,
I found out that the problem was with JAVA 17 and that the Gradle JDK in use was: Android Studio java home version 17.0.1
I changed it to: Android Studio default JDK version 11.0.10
Then everything worked like before...
You'll find the Gradle Settings under File > Project Structure...
...or through the Toolbar button: Project Structure...
class file major version 61 means that the class file you are trying to load has been compiled by Java 17 or higher and can only by used by Java 17+.
The Android toolchain only supports classes compiled for Java 11 (if the project is properly configured). So there is something wrong with the library you are trying to load.
As you don’t give any details in your question what you are trying to do, it is impossible to give you a more detailed answer.
Change version on ‘gradle-wrapper.properties’ file
‘distributionUrl=https://services.gradle.org/distributions/gradle-6.7-all.zip’
to
‘distributionUrl=https://services.gradle.org/distributions/gradle-7.6-all.zip’
Step 2:
In gradle.properties file remove this line ‘org.gradle.java.home’
4
Answers
With the help of @Robert answer,
I found out that the problem was with JAVA 17 and that the Gradle JDK in use was:
Android Studio java home version 17.0.1
I changed it to:
Android Studio default JDK version 11.0.10
Then everything worked like before...
You'll find the Gradle Settings under
File > Project Structure...
...or through the Toolbar button:
Project Structure...
Then click the
Gradle Settings
link.class file major version 61 means that the class file you are trying to load has been compiled by Java 17 or higher and can only by used by Java 17+.
The Android toolchain only supports classes compiled for Java 11 (if the project is properly configured). So there is something wrong with the library you are trying to load.
As you don’t give any details in your question what you are trying to do, it is impossible to give you a more detailed answer.
for mac users, please follow this:
download and install java 11 from here
edit your zshrc file with this:
open terminal and execute :
Now run
flutter doctor -v
Step 1:
‘distributionUrl=https://services.gradle.org/distributions/gradle-6.7-all.zip’
to
‘distributionUrl=https://services.gradle.org/distributions/gradle-7.6-all.zip’
Step 2:
Step 3:
In android/build.gradle file: