After updating Flutter sdk, this error appears in all my projects
FAILURE: Build failed with an exception.
-
Where:
Build file ‘C:flutterpackagesflutter_toolsgradlebuild.gradle.kts’ line: 10 -
What went wrong:
Build was configured to prefer settings repositories over project repositories but repository ‘Google’ was added by build file ‘appbuild.gradle’ -
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
2
Answers
Try this:
Nothing should changed in your git changes due to .gitignore file
Open Android Studio again
Go to File->Invalidate Caches/Restart, then invalidate caches and restart
if your project structure is corrupted go to: File -> Close Project, close project and reopen it, it should be back to normal.
Run all the necessary scripts starting with:
flutter pub get
dart pub get
If it’s helpful to you, then accept the answer and don’t forget to upvote.
If you just upgraded to flutter 3.19 from a previous version , there are some things you need to address.
I don’t seem to be able to find the official guide on this atm, so check this guide here:
https://medium.com/@iam.umairimran/flutter-app-migration-guide-updating-to-flutter-3-19-0-ab8b66008838