更新 Android Studio 和 flutter(和 kotlin)后,我收到此警告/错误
如何解决或者我可以忽略而不会导致错误?
预先感谢您。
W/FlutterJNI(23046): FlutterJNI.loadLibrary called more than once
W/FlutterJNI(23046): FlutterJNI.prefetchDefaultFontManager called more than once
W/FlutterJNI(23046): FlutterJNI.init called more than once
Run Code Online (Sandbox Code Playgroud)
编辑 2022 年 3 月 23 日:
这是因为“等待 Firebase.initializeApp();” 像提到的文档中那样被调用两次。我必须进行更多研究。也许可以使用 firebase_options.dart 来解决。
编辑 2022 年 4 月 16 日:
Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform,);
}
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform,);
// Set the background messaging handler early on, as a named top-level function
FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
//String? token =
await …Run Code Online (Sandbox Code Playgroud) flutter ×1