[英]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.这是我为消除该错误所做的一切。
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.