首页 > 解决方案 > Flutter尝试调用虚拟方法'boolean java.lang.String.equals(java.lang.Object)'

问题描述

使用颤振的插件file_picker,运行平稳,直到你选择一个文件,每当我选择一个文件,整个应用程序崩溃,在pubspec.yaml file_picker: ^1.12.0和颤振代码行是:

onTap: () async {
  File file = await FilePicker.getFilePath(type: FileType.video);
},

这一直在吃我,我在网上找到的解决方案都没有帮助。堆栈跟踪是:

D/FilePickerDelegate(16658): Selected type video/*
D/EGL_emulation(16658): eglMakeCurrent: 0x9f7462a0: ver 2 0 (tinfo 0x8fc0a3d0)
D/FlutterView(16658): Detaching from a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@c94b1b9
I/FilePickerDelegate(16658): [SingleFilePick] File URI:content://com.android.providers.downloads.documents/document/40
E/FilePickerUtils(16658): Getting for API 19 or abovecontent://com.android.providers.downloads.documents/document/40
E/AndroidRuntime(16658): FATAL EXCEPTION: Thread-4
E/AndroidRuntime(16658): Process: com.lulliezy.video, PID: 16658
E/AndroidRuntime(16658): java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
E/AndroidRuntime(16658):    at com.mr.flutter.plugin.filepicker.FilePickerDelegate$2.run(FilePickerDelegate.java:106)
E/AndroidRuntime(16658):    at java.lang.Thread.run(Thread.java:761)
E/FilePickerUtils(16658): Document URI
E/FilePickerUtils(16658): Downloads External Document URI
D/FlutterView(16658): Attaching to a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@c94b1b9
I/FilePickerDelegate(16658): Absolute file path:/storage/emulated/0/Download/videoplayback.mp4
D/EGL_emulation(16658): eglCreateContext: 0xa3f05780: maj 2 min 0 rcv 2
D/EGL_emulation(16658): eglMakeCurrent: 0xa3f05780: ver 2 0 (tinfo 0xa3f03200)
D/EGL_emulation(16658): eglMakeCurrent: 0x9f7462a0: ver 2 0 (tinfo 0x8fc0a3d0)
D/EGL_emulation(16658): eglMakeCurrent: 0xa3f05780: ver 2 0 (tinfo 0xa3f03200)
E/Surface (16658): queueBuffer: error queuing buffer to SurfaceTexture, -19
E/EGL_emulation(16658): tid 16675: swapBuffers(547): error 0x300d (EGL_BAD_SURFACE)
D/EGL_emulation(16658): eglMakeCurrent: 0x9f7462a0: ver 2 0 (tinfo 0x8fc0a3d0)
D/FlutterView(16658): Detaching from a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@c94b1b9
D/FlutterActivityAndFragmentDelegate(16658): Detaching FlutterEngine from the Activity that owns this Fragment.
D/FlutterEngine(16658): Destroying.
D/FlutterEnginePluginRegistry(16658): Destroying.

对此的任何帮助将不胜感激。

另外,我对 Flutter/Dart 还很陌生,所以请原谅我的无知。

标签: flutterdart

解决方案


尝试升级你的颤振版本

你也可以看看这个线程


推荐阅读