Build Failing with an exception when adding firebase_auth or cloud_firestore in the pubspec.yaml file (firebase_core is working):

冷暖自知 提交于 2021-01-29 05:51:05

问题


From the run terminal of android studio:

FAILURE: Build failed with an exception.

  • Where: Script 'C:\Flutter\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 362

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

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

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

Similar issue with firebase_auth.


回答1:


Had a similar problem recently, here are the steps that fixed it for me.

  1. Run flutter pub upgrade to upgrade all the Firebase plugins to the latest versions.

  2. Use the steps at https://firebase.flutter.dev/docs/migration to check for any deprecated code.

  3. In the android/build.gradle file, make sure the google services dependency is classpath 'com.google.gms:google-services:4.3.3' or whatever the latest version is.

  4. In the android/app/build.gradle file, if you have any dependencies of the form implementation 'com.google.firebase:[firebase-product:version-number] then get rid of those lines

  5. Run flutter clean



来源:https://stackoverflow.com/questions/63595675/build-failing-with-an-exception-when-adding-firebase-auth-or-cloud-firestore-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!