【问题标题】:Flutter: Camera keeps stopping error on image_picker packageFlutter:相机在 image_picker 包上不断停止错误
【发布时间】:2020-04-07 10:20:17
【问题描述】:

我正在使用image_picker 包来处理相机,但每当我触发相机中的拾取图像时,应用程序就会崩溃。我得到的错误是Camera keeps stopping

我使用的代码是

Future<void> _takePicture() async {
    final imageFile = await ImagePicker.pickImage(
      source: ImageSource.camera,
      maxWidth: 600,
    );
}

我在单击按钮时调用此函数。这是我在调试控制台中得到的:

D/FlutterView(24995): Detaching from a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@5a82446
D/FlutterActivityAndFragmentDelegate(24995): Detaching FlutterEngine from the Activity that owns this Fragment.
D/FlutterEngine(24995): Destroying.
D/FlutterEnginePluginRegistry(24995): Destroying.

【问题讨论】:

  • 你确定flutter更新到最新版本了吗?
  • @MahmoudAbuElheja 是的,我正在使用最新版本的 Flutter。
  • 好的,请在您的代码上添加 try 和 catch 并检查抛出异常时的错误代码
  • 显示这个 (stackoverflow.com/questions/56080818/…) 以了解如何在 catch 中捕获它并打印错误代码
  • @MahmoudAbuElheja 也尝试使用 try catch,没有打印错误。

标签: flutter


【解决方案1】:

问题与模拟器有关。虽然不知道它是什么,但我在一个新创建的模拟器上运行该应用程序并且相机工作正常。

【讨论】:

    猜你喜欢
    • 2019-10-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-19
    • 2018-01-15
    • 2013-02-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多