Flutter error:尝试在空对象引用上调用虚方法'void com.google.firebase.auth.internal.zzab.zzf(int)',null(示例代码
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Flutter error:尝试在空对象引用上调用虚方法'void com.google.firebase.auth.internal.zzab.zzf(int)',null(示例代码相关的知识,希望对你有一定的参考价值。
每当我构建我的应用程序时,我的应用程序成功构建,但在安装到设备时,我收到跟随错误和应用程序崩溃的设备与白色屏幕。
Launching lib/main.dart on Pixel 2 XL in debug mode...
Initializing gradle...
Resolving dependencies...
Running 'gradlew assembleDebug'...
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
Note: /Users/sureshkumarmajhi/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.8.2+1/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /Users/sureshkumarmajhi/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.15/android/src/main/java/io/flutter/plugins/firebaseauth/FirebaseAuthPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/sureshkumarmajhi/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.15/android/src/main/java/io/flutter/plugins/firebaseauth/FirebaseAuthPlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /Users/sureshkumarmajhi/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.2.5+1/android/src/main/java/io/flutter/plugins/firebase/core/FirebaseCorePlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
/Users/sureshkumarmajhi/.pub-cache/hosted/pub.dartlang.org/firebase_storage-1.0.1/android/src/main/java/io/flutter/plugins/firebase/storage/FirebaseStoragePlugin.java:293: warning: [unchecked] unchecked cast
Map<String, String> customMetadata = (Map<String, String>) map.get("customMetadata");
^
required: Map<String,String>
found: Object
1 warning
Note: /Users/sureshkumarmajhi/.pub-cache/hosted/pub.dartlang.org/video_player-0.6.4/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayerPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Built build/app/outputs/apk/debug/app-debug.apk.
Installing build/app/outputs/apk/app.apk...
E/MethodChannel#plugins.flutter.io/cloud_firestore( 2716): Failed to handle method call
E/MethodChannel#plugins.flutter.io/cloud_firestore( 2716): java.lang.NullPointerException: Attempt to invoke virtual method 'void com.google.firebase.auth.internal.zzab.zzf(int)' on a null object reference
E/MethodChannel#plugins.flutter.io/cloud_firestore( 2716): at com.google.firebase.auth.FirebaseAuth.addIdTokenListener(Unknown Source:16)
E/MethodChannel#plugins.flutter.io/cloud_firestore( 2716): at com.google.firebase.firestore.obfuscated.zzc.<init>(com.google.firebase:firebase-firestore@@17.1.1:76)
E/MethodChannel#plugins.flutter.io/cloud_firestore( 2716): at com.google.firebase.firestore.FirebaseFirestore.zza(com.google.firebase:firebase-firestore@@17.1.1:109)
E/MethodChannel#plugins.flutter.io/cloud_firestore( 2716): at com.google.firebase.firestore.zzh.zza(com.google.firebase:firebase-firestore@@17.1.1:51)
E/MethodChannel#plugins.flutter.io/cloud_firestore( 2716): at com.google.firebase.firestore.FirebaseFirestore.zza(com.google.firebase:firebase-firestore@@17.1.1:87)
E/MethodChannel#plugins.flutter.io/cloud_firestore( 2716): at com.google.firebase.firestore.FirebaseFirestore.getInstance(com.google.firebase:firebase-firestore@@17.1.1:78)
E/MethodChannel#plugins.flutter.io/cloud_firestore( 2716): at io.flutter.plugins.firebase.cloudfirestore.CloudFirestorePlugin.getFirestore(CloudFirestorePlugin.java:82)
E/MethodChannel#plugins.flutter.io/cloud_firestore( 2716): at io.flutter.plugins.firebase.cloudfirestore.CloudFirestorePlugin.onMethodCall(CloudFirestorePlugin.java:603)
E/MethodChannel#plugins.flutter.io/cloud_firestore( 2716): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:191)
E/MethodChannel#plugins.flutter.io/cloud_firestore( 2716): at io.flutter.view.FlutterNativeView.handlePlatformMessage(FlutterNativeView.java:163)
E/MethodChannel#plugins.flutter.io/cloud_firestore( 2716): at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#plugins.flutter.io/cloud_firestore( 2716): at android.os.MessageQueue.next(MessageQueue.java:326)
E/MethodChannel#plugins.flutter.io/cloud_firestore( 2716): at android.os.Looper.loop(Looper.java:160)
E/MethodChannel#plugins.flutter.io/cloud_firestore( 2716): at android.app.ActivityThread.main(ActivityThread.java:6669)
E/MethodChannel#plugins.flutter.io/cloud_firestore( 2716): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#plugins.flutter.io/cloud_firestore( 2716): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
E/MethodChannel#plugins.flutter.io/cloud_firestore( 2716): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
E/flutter ( 2716): [ERROR:flutter/shell/common/shell.cc(181)] Dart Error: Unhandled exception:
E/flutter ( 2716): PlatformException(error, Attempt to invoke virtual method 'void com.google.firebase.auth.internal.zzab.zzf(int)' on a null object reference, null)
E/flutter ( 2716): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:551:7)
E/flutter ( 2716): #1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:279:18)
E/flutter ( 2716): <asynchronous suspension>
E/flutter ( 2716): #2 Firestore.settings (file:///Users/sureshkumarmajhi/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.8.2+1/lib/src/firestore.dart:136:19)
E/flutter ( 2716): <asynchronous suspension>
E/flutter ( 2716): #3 main (file:///Users/sureshkumarmajhi/AndroidStudioProjects/bhramaan/lib/main.dart:62:19)
E/flutter ( 2716): <asynchronous suspension>
E/flutter ( 2716): #4 _startIsolate.<anonymous closure> (dart:isolate/runtime/libisolate_patch.dart:289:19)
E/flutter ( 2716): #5 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
Syncing files to device Pixel 2 XL...
升级到最新的cloud_firestore: ^0.8.2+1
后,我收到此错误。无法理解发生了什么。 :(
从firebase_auth: "^0.6.2+1"
(前一个)更新到最新的firebase_auth: "^0.5.15"
后解决了我的问题。希望它能帮助别人。 :)
以上是关于Flutter error:尝试在空对象引用上调用虚方法'void com.google.firebase.auth.internal.zzab.zzf(int)',null(示例代码的主要内容,如果未能解决你的问题,请参考以下文章
错误:java.lang.NullPointerException:尝试在空对象引用上调用接口方法“int java.util.List.size()”
NullPointerException:尝试在空对象引用上调用虚拟方法 findViewById(int)'
NullPointerException 尝试在空对象引用上调用 method.GoogleMap.setMapType(int)'
致命异常: main ,尝试在空对象引用上调用虚拟方法 [重复]
尝试在空对象引用上调用虚拟方法 com.google.firebase.iid.FirebaseInstanceId.getInstanceId()'