just created new flutter project with the command flutter create test
.
When start it failed with this error:
FAILURE: Build failed with an exception.
* What went wrong:
Could not open settings generic class cache for settings file 'D:sandboxmobile-appshebatestappandroidsettings.gradle' (C:Usersgrebe.gradlecaches7.4scriptsea4ydi90mwjg9g63m7r6nimmx).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 63
* 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 5s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
Device: Emulated Android 12
Flutter doctor output is:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.3.10, on Microsoft Windows [version 10.0.22621.1105], locale fr-FR)
[√] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Build Tools 2019 16.11.15)
[!] Android Studio (version 2022.1)
X Unable to find bundled Java version.
[√] VS Code (version 1.74.3)
[√] Connected device (4 available)
[√] HTTP Host Availability
! Doctor found issues in 1 category.
Thanks for help 🙂
2
Answers
is it your first project with flutter on your device ?
Also mention what is your device and it’s OS version.
Problem:
[!] Android Studio (version 2022.1) X Unable to find bundled Java version.
answer :
Go to "C:Program FilesAndroidAndroid Studio" and then copy the content of jbr and paste the content into jre folder run doctor again
just change your gradle version to 7.6 .
follow the steps 1android>gradle>gradle-property
check this line distributionUrl=https://services.gradle.org/distributions/gradle-7.6-all.zip)
this 7.6 should not be 7.4 or less