0

i tried to run a basic code in android studio. but it showing error. but the same code successfully compiled on flutlab.io

here is the error message.

Running Gradle task 'assembleDebug'...

FAILURE: Build failed with an exception.

* What went wrong:
Could not open settings generic class cache for settings file 'C:\Users\HP\AndroidStudioProjects\helloapp\android\settings.gradle' (C:\Users\HP\.gradle\caches\6.7\scripts\1fnwrr8g4rohfp291nvlxj5qe).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 60

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s
Exception: Gradle task assembleDebug failed with exit code 1

i'm new to android studio. so please tell what's the wrong here.

Zihan
  • 9
  • 1
  • Does this answer your question? [Could not open settings generic class cache for settings file '](https://stackoverflow.com/questions/67240279/could-not-open-settings-generic-class-cache-for-settings-file) – Ruchit Aug 04 '21 at 06:53
  • try to my answer here https://stackoverflow.com/a/68640043/13997210 – Ravindra S. Patil Aug 04 '21 at 06:53

1 Answers1

0

Try to use JAVA SDK 15.

First remove your old JDK, and download & install Java JDK 15 from here.

Then, in Android Studio, change the path to the Java JDK so that it matches the latest install. Finally, restart Android Studio to apply the changes.

Gael Lorieul
  • 3,006
  • 4
  • 25
  • 50
keyur
  • 151
  • 13
  • yes. i tried to install with watching a you Tube video. but that is JAVA but i want flutter. already downloaded JAVA SDK also. what's the problem here? – Zihan Aug 04 '21 at 08:20
  • it's JDK version issue .you can remove old JDK version and download JDK 15 from here : https://www.oracle.com/java/technologies/javase/jdk15-archive-downloads.html. after set new path it is JDK 15 than restart Android studio – keyur Aug 04 '21 at 08:24
  • Thank You. i downloaded sdk 15 and now it working – Zihan Aug 04 '21 at 15:21