Flutter/Dart - FlutterFirebaseMessagingPlugin.java - 构建失败,出现异常“错误:找不到符号”
2022-09-03 09:05:34
升级到 Null Safety 后,当我尝试在 Android Studio 中构建我的 Flutter 应用程序时,我遇到了错误。sdk: ">=2.12.0 <3.0.0"
C:\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_messaging-9.1.4\android\src\main\java\io\flutter\plugins\firebase\messaging\FlutterFirebaseMessagingPlugin.java:20: error: cannot find symbol
import com.google.firebase.iid.FirebaseInstanceId;
^
symbol: class FirebaseInstanceId
location: package com.google.firebase.iid
C:\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_messaging-9.1.4\android\src\main\java\io\flutter\plugins\firebase\messaging\FlutterFirebaseMessagingPlugin.java:21: error: cannot find symbol
import com.google.firebase.iid.Metadata;
^
symbol: class Metadata
location: package com.google.firebase.iid
C:\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_messaging-9.1.4\android\src\main\java\io\flutter\plugins\firebase\messaging\FlutterFirebaseMessagingPlugin.java:152: error: cannot find symbol
: Metadata.getDefaultSenderId(FirebaseApp.getInstance());
^
symbol: variable Metadata
location: class FlutterFirebaseMessagingPlugin
C:\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_messaging-9.1.4\android\src\main\java\io\flutter\plugins\firebase\messaging\FlutterFirebaseMessagingPlugin.java:153: error: cannot find symbol
FirebaseInstanceId.getInstance().deleteToken(senderId, "*");
^
symbol: variable FirebaseInstanceId
location: class FlutterFirebaseMessagingPlugin
C:\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_messaging-9.1.4\android\src\main\java\io\flutter\plugins\firebase\messaging\FlutterFirebaseMessagingPlugin.java:165: error: cannot find symbol
: Metadata.getDefaultSenderId(FirebaseApp.getInstance());
^
symbol: variable Metadata
location: class FlutterFirebaseMessagingPlugin
C:\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_messaging-9.1.4\android\src\main\java\io\flutter\plugins\firebase\messaging\FlutterFirebaseMessagingPlugin.java:166: error: cannot find symbol
String token = FirebaseInstanceId.getInstance().getToken(senderId, "*");
^
symbol: variable FirebaseInstanceId
location: class FlutterFirebaseMessagingPlugin
Android Studio告诉我FlutterFirebaseMessagingPlugin.java“找不到符号”。那么这意味着什么,我该如何解决它