flutter - 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 还很陌生,所以请原谅我的无知。
解决方案
尝试升级你的颤振版本
你也可以看看这个线程
推荐阅读
- android - 如何在每个新页面上创建可单击的 ListView 并在单击时打开 JSON 数据?
- apache-spark - 拆分RDD字符串并在一个语句中与其他RDD元素组合
- php - 如何验证输入是否为数字
- angular - 知道从哪个 html 调用组件
- json - 如何在 Azure Logic App 中从 blob json 创建 html 表
- eclipse - 文件上传的自动代码在 selenium 中不起作用。输入路径后 Windows 消失
- laravel - Laravel API 临时图像通过 url
- regex - 在python中使用正则表达式拆分
- neo4j - Neo4J 查询相关用户
- angular - 返回订阅结果作为承诺