【发布时间】: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