gpt4 book ai didi

flutter 错误 : cannot find symbol import com. google.firebase.firestore.TransactionOptions

转载 作者:行者123 更新时间:2023-12-05 04:25:28 28 4
gpt4 key购买 nike

自从 Cloud Firestore 3.4.3 的最新更新后,我无法再构建 Flutter 应用。

    /Applications/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-3.4.3/android/src/main/java/io/flutter/plugins/firebase/firestore/streamhandler/TransactionStreamHandler.java:13: error: cannot find symbol
import com.google.firebase.firestore.TransactionOptions;
^
symbol: class TransactionOptions
location: package com.google.firebase.firestore
/Applications/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-3.4.3/android/src/main/java/io/flutter/plugins/firebase/firestore/streamhandler/TransactionStreamHandler.java:66: error: package TransactionOptions does not exist
new TransactionOptions.Builder().setMaxAttempts(maxAttempts).build(),
^
2 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':cloud_firestore:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* 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

BUILD FAILED in 9s
Exception: Gradle task assembleDebug failed with exit code 1
Exited

我尝试删除文件夹 /Applications/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-3.4.3 并执行 flutter clean。此外,我将 cloud_firestore 降级为 3.3.0,但该文件夹重新安装了相同的 3.4.3 版本。

有什么建议吗?

最佳答案

这是我为消除该错误所做的一切。

根据 this link :

flutter upgrade --force --verbose&&flutter update-packages --force-upgrade&&flutter pub upgrade --major-versions

添加到我的 main.dart 中:

import 'package:firebase_auth_platform_interface/firebase_auth_platform_interface.dart' show FirebaseAuthPlatform;

运行 flutter pub get——注意没有改善。

因此,另外,我手动升级我的 pubspec.yaml:

firebase_core: ^1.21.0
cloud_firestore: ^3.3.0
firebase_auth: ^3.6.4
firebase_auth_platform_interface: ^6.5.4
cloud_firestore_odm: ^1.0.0-dev.27

运行 flutter pub upgrade && flutter pub get

现在可以了。

关于 flutter 错误 : cannot find symbol import com. google.firebase.firestore.TransactionOptions,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73252371/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com