getting this error :
A problem occurred configuring project ‘:flutter_plugin_android_lifecycle’.
Could not open proj generic class cache for build file ‘C:UsersDELLAppDataLocalPubCachehostedpub.devflutter_plugin_android_lifecycle-2.0.23androidbuild.gradle’ (C:UsersDELL.gradlecaches7.6scripts63bprwnkn9zt5gyu8l1lw245x).
BUG! exception in phase ‘semantic analysis’ in source unit ‘BuildScript‘ Unsupported class file major version 65
Failed to notify project evaluation listener.
Could not get unknown property ‘android’ for project ‘:flutter_plugin_android_lifecycle’ of type org.gradle.api.Project.
Could not get unknown property ‘android’ for project ‘:flutter_plugin_android_lifecycle’ of type org.gradle.api.Project.
and above is output of flutter doctor -v
[√] Android toolchain – develop for Android devices (Android SDK version 35.0.0)• Android SDK at C:UsersDELLAppDataLocalAndroidsdk
• Platform android-35, build-tools 35.0.0
• Java binary at: C:Program FilesAndroidAndroid Studiojbrbinjava
• Java version OpenJDK Runtime Environment (build 21.0.3+-12282718-b509.11)
• All Android licenses accepted.
i have tried to update "distributionUrl=https://services.gradle.org/distributions/gradle-7.6-all.zip" gradle version in gradle-wrapper.properties file but didn’t work
2
Answers
Since
flutter_plugin_android_lifecycle
is a separate plugin from your project, you should try by upgrading its version in yourpubspec.yaml
or checking on their pub.dev page if there’s any information on upgrade issues.If it’s not a plugin that your project directly depends on, you should check which other plugins depend on it and try to update them.
The phrase "Unsupported class file major version 65" is usually used to indicate that some Java environment is trying to run a file compiled with a more recent version of Java (like using a JRE15 to run a file compiled with JRE16), so maybe that can give some pointers to what to look out for.
Android Studio Labybug comes shipped with Java 21. This version is not currently compatible with Flutter. You need to download Java 17 and link that in to Flutter. Details can be found in this duplicate issue: Flutter 3.24.3 problem with Android Studio Ladybug | 2024.2.1
You may be able to confirm the incompatibility by running