what wet wrong:
could not open setting generic class cache for setting file "D: \projects\app\android\setting.gradle" (c: \user\name\.gradle\caches\7.5\scripts\).
> BUG! execption in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 65.
Build failed.
i change the gradle from 7.5 to 8.4 and 8.5 and the it fail to build. i try to change the java version in android studio from version 21 to 17. but i was not able to change the java version in android studio. what will be the solution?
Don’t know about your tries as you didn’t share their outputs, but the message you showed says that you tried to build a Gradle 7.5 build with using Java 21 as Gradle JVM and that is not compatible as you probably found out.
this is the result when try to build . i worked on version change for gradle and i couldn’t change java version in android studio . do you know how to change. i tried to change in environmental variable as well as gradle jdk.
Please never anywhere share screenshots of text if you only want to share the text and not something additional like colors or IDE annotations. Text in images is hard to read, especially on mobile, very hard to copy, and nearly impossible to search for.
Besides that, it is the same error you already posted.
Regarding where to change Gradle version, I have no idea whether with Flutter it is different as I don’t do Flutter or Android development. How do you invoke Gradle? Directly, or through some Flutter tool, or …?
Gradle indirectly through Flutter’s build system.You can change the Gradle version in two places:
1. Gradle Wrapper Version:
android/gradle/wrapper/gradle-wrapper.properties.
distributionUrl=https://services.gradle.org/distributions/gradle-7.5-all.zip
2. Gradle Plugin Version :
android/build.gradle or android/app/build.gradle.
classpath ‘com.android.tools.build:gradle:7.1.2’
No, you cannot.
Where you have 7.5-all (which is bad practice, should be 7.5-bin) you configure the Gradle version.
Where you have 7.1.2 this has nothing to do with the Gradle version. Google just unluckily decided to name their artifact gradle, but it is the Android Gradle Plugin version that you configure there.
If you run Gradle indirectly through Flutter, you should ask in a Flutter community how to configure the Java version, not in a Gradle community.