【问题标题】:A problem occurred evaluating project ':firebase_auth'评估项目“:firebase_auth”时出现问题
【发布时间】:2022-01-07 23:10:19
【问题描述】:

当项目已经处于运行状态时不会发生此错误。但是第二天我尝试运行相同的项目然后出现此错误。

FAILURE:构建失败并出现异常。

  • 在哪里:构建文件 'D:\src\flutter.pub-cache\hosted\pub.dartlang.org\firebase_auth-3.2.0\android\build.gradle' 行:58

  • 出了什么问题:评估项目“:firebase_auth”时出现问题。

无法加载脚本“D:\src\flutter.pub-cache\hosted\pub.dartlang.org\firebase_auth-3.2.0\android\user-agent.gradle”的编译类 来自缓存。

  • 尝试:使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。运行 --scan 以获得完整的见解。

  • 通过https://help.gradle.org获得更多帮助

17 秒后构建失败

异常:Gradle 任务 assembleDebug 失败,退出代码为 1 Exited (sigterm)

这是我的 pubspec.yml 依赖项

version: 1.0.0+1

environment:
  sdk: ">=2.12.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter


  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.2
  firebase_core: "^1.10.0"
  firebase_auth: ^3.2.0

【问题讨论】:

    标签: android firebase flutter firebase-authentication


    【解决方案1】:

    这看起来像是 android 配置 问题。

    解决方案是将依赖项添加到您的android项目中。

    第一步是按照 Firebase Auth 的 pub.dev 页面上的说明进行操作

    您可以通过将以下行添加到您的 android/build.gradle 文件中来做到这一点:

    dependencies {
        // Example existing classpath
        classpath 'com.android.tools.build:gradle:3.2.1'
       // Add the google services classpath
       classpath 'com.google.gms:google-services:4.3.0'
     }
    

    并将以下行添加到 android/app/build.gradle 文件的底部

      apply plugin: 'com.google.gms.google-services'
    

    接下来要做的是将 Firebase Auth 插件添加到您的 android 实现

    为此,您应该按照说明操作 => https://firebase.google.com/docs/android/setup#available-libraries

    干杯! :-)

    【讨论】:

    • 不,不工作.. 以上步骤已经包含在我的配置中
    • flutter clean 然后 pub get 然后检查
    • flutter clean 然后 flutter pub get 不起作用。现在尝试你的第二个建议。
    • 也没有工作......每当我删除firebase auth的依赖......然后它就会运行...... firebase auth的问题
    猜你喜欢
    • 2020-04-08
    • 2021-10-07
    • 2020-08-11
    • 2021-05-25
    • 2022-08-13
    • 2021-06-26
    • 2020-03-24
    • 1970-01-01
    • 2021-04-09
    相关资源
    最近更新 更多