华为y5上的PlatformException(already_active,图像选择器已处于活动状态,null)

时间:2019-11-21 07:43:22

标签: flutter

E/flutter (15907): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: PlatformException(already_active, Image picker is already active, null)
E/flutter (15907): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:564:7)
E/flutter (15907): #1      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:316:33)
E/flutter (15907): <asynchronous suspension>
E/flutter (15907): #2      ImagePicker.pickImage (package:image_picker/image_picker.dart:59:40)

如何解决此图像选择器相关性错误?

2 个答案:

答案 0 :(得分:2)

卸载应用程序然后重新安装,如果问题仍然存在,也许您正在使用 super 覆盖 MainActivity 上的任何方法,例如对我来说添加 super onActivity 结果有帮助,这是我从这个链接找到的。

参考链接https://github.com/flutter/flutter/issues/19103#issuecomment-412647536

  override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent) {
    super.onActivityResult(requestCode, resultCode, data); // had to add this line.

答案 1 :(得分:0)

就我而言,我没有授予对“文件”的访问权限。连接USB时,如图所示提供访问权限:

enter image description here