简体   繁体   English

Flutter 错误:找不到符号导入 com.google.firebase.firestore.TransactionOptions

[英]Flutter Error: cannot find symbol import com.google.firebase.firestore.TransactionOptions

Since the latest update to Cloud Firestore 3.4.3 I cannot build the Flutter app anymore.由于 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

I tried removing the folder /Applications/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-3.4.3 and performing flutter clean.我尝试删除文件夹/Applications/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-3.4.3并执行 flutter 清理。 Moreover I downgraded cloud_firestore to 3.3.0, but the folder was reinstalled with the same 3.4.3 version.此外,我将 cloud_firestore 降级为 3.3.0,但该文件夹重新安装了相同的 3.4.3 版本。

Any suggestion?有什么建议吗?

Here's everything I did to get that error gone.这是我为消除该错误所做的一切。

Per this link :根据此链接

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

Add to my main.dart:添加到我的 main.dart:

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

Run flutter pub get -- notice no improvement.运行flutter pub get - 注意没有改进。

So, additionally, I upgrade my pubspec.yaml manually:因此,另外,我手动升级了我的 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

Run flutter pub upgrade && fluter pub get运行flutter pub upgrade && fluter pub get

Now it works.现在它起作用了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 excel 或 google 电子表格或 CSV 使用 excel 导入 firebase firestore 数据库中的批量数据 - How to import bulk data in firebase firestore database from excel or google spreadsheet or CSV using flutter Android Studio 构建错误:Gradle - 找不到平台('com.google.firebase:firebase-bom:30.3.1') - Android Studio build error: Gradle - Could not find platform('com.google.firebase:firebase-bom:30.3.1') Flutter 错误:(getGoogleApiForMethod() 返回 Gms:com.google.firebase.auth.api.internal.zzaq@3e2567) - Flutter Error:(getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzaq@3e2567) flutter 动态查询 Firebase Firestore - flutter dynamic query Firebase Firestore 无法在 flutter 上使用 firebase 进行谷歌登录; “期待活页夹,但结果为空!” - Cannot proceed google login with firebase on flutter; "Expecting binder but got null!" CocoaPods 找不到 pod“Firebase/Core”的兼容版本 | cloud_firestore,Flutter - CocoaPods could not find compatible versions for pod "Firebase/Core” | cloud_firestore, Flutter Flutter Firebase 查询 Firestore 和 Streambuilder() 的问题 - Flutter Firebase Problems with Query Firestore and Streambuilder() Flutter - 无法将数据保存到 Firebase Firestore - Flutter - Unable to save data to Firebase Firestore Flutter:Firebase 身份验证和 Firestore 快照流 - Flutter: Firebase auth and Firestore snapshot stream Flutter firestore google service not found 并忽略 header x-firebase-locale 因为它的值为 null - Flutter firestore google service not found and ignoring header x-firebase-locale because its value was null
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM