抖动错误:无法找到符号import com.google.firebase.firestore.LoadBundleTa



我有一个firebase用户应用程序,让用户注册,显示他们的数据和编辑它。当我尝试在模拟器上运行应用程序时,会发生此错误。我在sdk 2.11.0上写了大部分这个应用程序,然后改成了2.12.0,以适应null安全,我不知道这是否是原因。

错误:

E:Flutterflutter.pub-cachehostedpub.dartlang.orgcloud_firestore-2.5.3androidsrcmainjavaioflutterpluginsfirebasefirestoreFlutterFirebaseFirestoreMessageCodec.java:19: error: cannot find symbol
import com.google.firebase.firestore.LoadBundleTaskProgress;
^
symbol:   class LoadBundleTaskProgress
location: package com.google.firebase.firestore
E:Flutterflutter.pub-cachehostedpub.dartlang.orgcloud_firestore-2.5.3androidsrcmainjavaioflutterpluginsfirebasefirestoreFlutterFirebaseFirestoreMessageCodec.java:158: error: cannot find symbol
ByteArrayOutputStream stream, LoadBundleTaskProgress snapshot) {
^
symbol:   class LoadBundleTaskProgress
location: class FlutterFirebaseFirestoreMessageCodec
E:Flutterflutter.pub-cachehostedpub.dartlang.orgcloud_firestore-2.5.3androidsrcmainjavaioflutterpluginsfirebasefirestorestreamhandlerLoadBundleStreamHandler.java:6: error: cannot find symbol
import com.google.firebase.firestore.LoadBundleTask;
^
symbol:   class LoadBundleTask
location: package com.google.firebase.firestore
E:Flutterflutter.pub-cachehostedpub.dartlang.orgcloud_firestore-2.5.3androidsrcmainjavaioflutterpluginsfirebasefirestoreFlutterFirebaseFirestoreMessageCodec.java:80: error: cannot find symbol
} else if (value instanceof LoadBundleTaskProgress) {
^
symbol:   class LoadBundleTaskProgress
location: class FlutterFirebaseFirestoreMessageCodec
E:Flutterflutter.pub-cachehostedpub.dartlang.orgcloud_firestore-2.5.3androidsrcmainjavaioflutterpluginsfirebasefirestoreFlutterFirebaseFirestoreMessageCodec.java:81: error: cannot find symbol
writeLoadBundleTaskProgress(stream, (LoadBundleTaskProgress) value);
^
symbol:   class LoadBundleTaskProgress
location: class FlutterFirebaseFirestoreMessageCodec
E:Flutterflutter.pub-cachehostedpub.dartlang.orgcloud_firestore-2.5.3androidsrcmainjavaioflutterpluginsfirebasefirestoreFlutterFirebaseFirestoreMessageCodec.java:166: error: package LoadBundleTaskProgress does not exist
LoadBundleTaskProgress.TaskState taskState = snapshot.getTaskState();
^
E:Flutterflutter.pub-cachehostedpub.dartlang.orgcloud_firestore-2.5.3androidsrcmainjavaioflutterpluginsfirebasefirestoreFlutterFirebaseFirestoreMessageCodec.java:170: error: cannot find symbol
case RUNNING:
^
symbol:   variable RUNNING
location: class FlutterFirebaseFirestoreMessageCodec
E:Flutterflutter.pub-cachehostedpub.dartlang.orgcloud_firestore-2.5.3androidsrcmainjavaioflutterpluginsfirebasefirestoreFlutterFirebaseFirestoreMessageCodec.java:173: error: cannot find symbol
case SUCCESS:
^
symbol:   variable SUCCESS
location: class FlutterFirebaseFirestoreMessageCodec
E:Flutterflutter.pub-cachehostedpub.dartlang.orgcloud_firestore-2.5.3androidsrcmainjavaioflutterpluginsfirebasefirestoreFlutterFirebaseFirestoreMessageCodec.java:176: error: cannot find symbol
case ERROR:
^
symbol:   variable ERROR
location: class FlutterFirebaseFirestoreMessageCodec
E:Flutterflutter.pub-cachehostedpub.dartlang.orgcloud_firestore-2.5.3androidsrcmainjavaioflutterpluginsfirebasefirestoreFlutterFirebaseFirestoreMessageCodec.java:353: error: cannot find symbol
query = query.whereNotEqualTo(fieldPath, value);
^
symbol:   method whereNotEqualTo(FieldPath,Object)
location: variable query of type Query
E:Flutterflutter.pub-cachehostedpub.dartlang.orgcloud_firestore-2.5.3androidsrcmainjavaioflutterpluginsfirebasefirestoreFlutterFirebaseFirestoreMessageCodec.java:375: error: cannot find symbol
query = query.whereNotIn(fieldPath, listValues);
^
symbol:   method whereNotIn(FieldPath,List<Object>)
location: variable query of type Query
E:Flutterflutter.pub-cachehostedpub.dartlang.orgcloud_firestore-2.5.3androidsrcmainjavaioflutterpluginsfirebasefirestoreFlutterFirebaseFirestoreMessageCodec.java:388: error: cannot find symbol
if (limitToLast != null) query = query.limitToLast(limitToLast.longValue());
^
symbol:   method limitToLast(long)
location: variable query of type Query
E:Flutterflutter.pub-cachehostedpub.dartlang.orgcloud_firestore-2.5.3androidsrcmainjavaioflutterpluginsfirebasefirestoreFlutterFirebaseFirestorePlugin.java:292: error: cannot find symbol
Query query = Tasks.await(firestore.getNamedQuery(name));
^
symbol:   method getNamedQuery(String)
location: variable firestore of type FirebaseFirestore
E:Flutterflutter.pub-cachehostedpub.dartlang.orgcloud_firestore-2.5.3androidsrcmainjavaioflutterpluginsfirebasefirestorestreamhandlerLoadBundleStreamHandler.java:25: error: cannot find symbol
LoadBundleTask task = firestore.loadBundle(bundle);
^
symbol:   class LoadBundleTask
location: class LoadBundleStreamHandler
E:Flutterflutter.pub-cachehostedpub.dartlang.orgcloud_firestore-2.5.3androidsrcmainjavaioflutterpluginsfirebasefirestorestreamhandlerLoadBundleStreamHandler.java:25: error: cannot find symbol
LoadBundleTask task = firestore.loadBundle(bundle);
^
symbol:   method loadBundle(byte[])
location: variable firestore of type FirebaseFirestore
Note: E:Flutterflutter.pub-cachehostedpub.dartlang.orgcloud_firestore-2.5.3androidsrcmainjavaioflutterpluginsfirebasefirestoreFlutterFirebaseFirestorePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: E:Flutterflutter.pub-cachehostedpub.dartlang.orgcloud_firestore-2.5.3androidsrcmainjavaioflutterpluginsfirebasefirestorestreamhandlerTransactionStreamHandler.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
15 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 1m 6s
Exception: Gradle task assembleDebug failed with exit code 1

这是我的pubspec的一部分。html文件:

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
cloud_firestore: ^2.5.3
firebase_core: ^1.7.0
firebase_auth: ^3.1.3
flutter_spinkit: ^5.1.0
provider: ^6.0.1
firebase: ^9.0.2
dev_dependencies:
flutter_test:
sdk: flutter

我认为这与SDK更新有关,这个问题可能是由于您的一些组件不适合null安全而引起的,并通过将它们更新到他们接受它的版本来解决。在这里,您可以找到有关该问题及其可能解决方案的相关信息。以下是可能的解决方案:

解决方案1当我将我的SDK版本更新为空安全时,我们需要做的就是将pusbpec.yaml中的firebase_messaging更新为支持空安全的版本a(例如:firebase_messaging: ^10.0.0),并从终端调用flutter pub get

  • pubspec开放。yaml文件。
  • 获取firebase_messaging的最新版本。
  • 已更新到最新版本。

解决方案2

首先,从pub.dev

获取最新版本的firebase依赖项执行以下命令:

flutter pub upgrade
flutter pub get
flutter clean

使缓存无效,重新启动,然后尝试运行应用程序。

解决方案1 firebase_messaging依赖项更新,我正在寻找确切的依赖项,这似乎是LoadBundleTaskProgress,但我所能找到的是,它是在cloud_firestore插件,并安装它,你需要做如下:

执行命令:

与颤振:

$ flutter pub add cloud_firestore 

这将在你的包的pubspec中添加这样一行。Yaml(并运行一个隐式flutter pub get):

dependencies:   
cloud_firestore: ^2.5.3

如果您已经尝试了,但消息仍然显示,您可能需要检查您的导入。