skip to Main Content

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.

2

Answers


  1. Try this:

    1. Close project.
    2. Go to project repository folder.
    3. Delete all generated files, for example:
      • .dart_tool
      • .idea
      • .build
      • .flutter-plugins
      • .flutter-plugins-dependencies
      • .metadata
      • .packages

    Nothing should changed in your git changes due to .gitignore file

    1. Open Android Studio again

    2. 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.

    3. 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.

    Login or Signup to reply.
  2. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search