I've been working on a flutter app. Recently I had to re install everything in my pc and ever since then, this error keeps popping up:

Launching lib/main.dart on SM G615F in debug mode... lib/main.dart:1

FAILURE: Build failed with an exception.

  • What went wrong: A problem occurred configuring project ':firebase_auth'.

Could not resolve all dependencies for configuration ':firebase_auth:classpath'.

Could not load module metadata from /home/user/.gradle/caches/modules-2/metadata-2.96/descriptors/org.jetbrains.kotlin/kotlin-stdlib/1.3.50/a8be1fe3b3911d3d3425fe720cf42835/descriptor.bin Failed to notify project evaluation listener.

Could not get unknown property 'android' for project ':firebase_auth' of type org.gradle.api.Project.

Could not find method implementation() for arguments [project ':firebase_core'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

Could not get unknown property 'android' for project ':firebase_auth' of type org.gradle.api.Project.

  • 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

I have added all the dependencies necessary:

    sdk: flutter
  cupertino_icons: ^1.0.2
  intl_phone_number_input: ^0.7.0+2
  flutter_spinkit: ^5.1.0
  provider: ^6.0.2
  firebase_core: ^1.15.0
  firebase_auth: ^3.3.16
  firebase_storage: ^10.2.14
  cloud_firestore: ^3.1.13
  shared_preferences: ^2.0.13
  fluttertoast: ^8.0.9
  get: ^4.6.1

Even the necessary lines in both app level and android level build.gradle are present. There doesn't seem to be any solutions present in here for this particular problem so any help will be greatly appreciated.

I tried removing the dependencies that are throwing the error (shared_preferences, intl_phone_number_input, fluttertoast, firebase_auth, firebase_core, cloud_firestore) and it worked. Then I added the dependencies again and reloaded the app without stopping it and it still worked fine. But when I stopped the app and restarted again, it threw the same error.

Solution 1: Abin Gomez

This was an issue with the latest version of flutter. I was using 2.10.5 before and it got updated when I had to reinstall everything. I downgraded it to an older version and cleared the cache and everything got fixed.